2017-08-27 6 views
1

Windows 10(64ビット)にPython 3.6.2(64ビット)をダウンロードしました。今私はDjangoフレームワークに取り組んでいますので、pipコマンドを使ってDjangoをダウンロードしたいのですが、それはErrorと表示されます。Python 3.6.2にDjangoをデプロイ

C:\Windows\system32>pip install django 
Collecting django 
    Using cached Django-1.11.4-py2.py3-none-any.whl 
Collecting pytz (from django) 
    Using cached pytz-2017.2-py2.py3-none-any.whl 
Installing collected packages: pytz, django 

例外:ジャンゴと仕事をする

Traceback (most recent call last): 
     File "c:\program files\python36\lib\site-packages\pip\basecommand.py", line 215, in main 
     status = self.run(options, args) 
     File "c:\program files\python36\lib\site-packages\pip\commands\install.py", line 342, in run 
     prefix=options.prefix_path, 
     File "c:\program files\python36\lib\site-packages\pip\req\req_set.py", line 784, in install 
     **kwargs 
     File "c:\program files\python36\lib\site-packages\pip\req\req_install.py", line 851, in install 
     self.move_wheel_files(self.source_dir, root=root, prefix=prefix) 
     File "c:\program files\python36\lib\site-packages\pip\req\req_install.py", line 1064, in move_wheel_files 
     isolated=self.isolated, 
     File "c:\program files\python36\lib\site-packages\pip\wheel.py", line 345, in move_wheel_files 
     clobber(source, lib_dir, True) 
     File "c:\program files\python36\lib\site-packages\pip\wheel.py", line 316, in clobber 
     ensure_dir(destdir) 
     File "c:\program files\python36\lib\site-packages\pip\utils\__init__.py", line 83, in ensure_dir 
     os.makedirs(path) 
     File "c:\program files\python36\lib\os.py", line 220, in makedirs 
     mkdir(name, mode) 
    PermissionError: [WinError 5] Access is denied: 'c:\\program files\\python36\\Lib\\site-packages\\pytz' 
+0

あなたは管理者としてコマンドプロンプトを実行していますか? –

+0

このpipコマンドをcmdで実行しても、管理者として実行してcmdを実行しようとすると、開いている可能性がありますか? Uは、タスクバーのスタートボタンを右クリックし、コマンドプロンプト(管理者)オプションを選択する必要があります。次にこのコマンドをもう一度試してください –

答えて

1

最良の方法は、仮想環境内にあります。システムのPython 3.6にパッケージをインストールすると、Python 3.6で実行しているすべてのプログラムに影響します。複数のDjangoアプリケーションを使用している場合、要件がすべて混在する可能性があります。

Djangoは仮想環境でうまく動作します。良いチュートリアルhereがあります。基本的には、プロジェクトごとに仮想環境を設定し、その環境内にDjango(およびその依存関係)をきれいにインストールしたいとします。これにより、「アクセスが拒否されました」などのエラーは発生しません。

仮想環境がどのように役立つかの例と同じように、さまざまなバージョンのDjangoを異なるアプリケーションで使用する必要がある場合は、同じ仮想環境内のアプリケーションのみに制限する必要があります。次に、別のアプリの別の環境でパッケージを別々にインストールできます。そうすれば、あなたのアプリから「django」をインポートすると、必要なバージョンが得られます。

+0

ありがとうございました... –

+1

答えが投票してそれを受け入れるなら –

2

問題はPythonをインストールするために選択した場所と関係があります。通常はC:\ pythonXXにインストールされていますが、インストールはC:\ Program Files \ pythonXXにあります。それは常に問題を引き起こすでしょう、あなたは常に管理者としてそれを実行する必要があります。クイックで最高のソリューション、アンインストールし、デフォルトの場所にPythonをインストールする受け入れる - C:\ pythonXX

関連する問題