2017-08-22 76 views
-1

我試圖安裝python virtualenv。 所以我跑命令在安裝virtualenv時出現異常錯誤

pip install virtualenv 

我遇到了這些錯誤。

Exception: 
Traceback (most recent call last): 
    File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/basecommand.py", line 215, in main 
    status = self.run(options, args) 
    File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/commands/install.py", line 342, in run 
    prefix=options.prefix_path, 
    File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_set.py", line 784, in install 
    **kwargs 
    File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_install.py", line 851, in install 
    self.move_wheel_files(self.source_dir, root=root, prefix=prefix) 
    File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_install.py", line 1064, in move_wheel_files 
    isolated=self.isolated, 
    File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/wheel.py", line 345, in move_wheel_files 
    clobber(source, lib_dir, True) 
    File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/wheel.py", line 323, in clobber 
    shutil.copyfile(srcfile, destfile) 
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 83, in copyfile 
    with open(dst, 'wb') as fdst: 
IOError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/virtualenv.py' 
+1

嘗試運行 'sudo的點子安裝的virtualenv' – AK47

+1

的可能的複製[Django的安裝:不能使用PIP在Linux上安裝Django(Ubuntu的)(https://stackoverflow.com/questions/19629685/django-installation -cannot-use-pip-to-install-django-on-linuxubuntu) – iled

回答

2

您在一臺Mac的系統級目錄安裝virtualenv包。 Mac使用預先安裝的較舊的Python(2.7.10)。要在您確定的系統目錄中安裝virtualenv程序包,您需要使用sudo,因爲寫入系統目錄需要提升權限。

sudo pip install virtualenv 

另一種選擇是使用--user選項將其安裝到用戶目錄。

pip install --user virtualenv 
+0

上帝,現在我知道我爲什麼討厭python這麼多。每次我安裝一些東西,都會出現問題。我安裝了最新的python2,最後我可以繼續說出pip安裝信心。你保存得像我的小時謝謝你 – MuhsinFatih

1

儘量使用sudo運行它:

sudo pip install virtualenv 

否則顯式調用python命令

python -m pip install virtualenv