2015-07-01 59 views
2

我正在按照Django的設置教程,我必須在我的文件夾中設置一個虛擬環境。我沒有virtualenv,所以我也sudo pip install virtualenv和得到這個消息時,它被安裝後:Django VirtualEnv設置 - 'setuptools pip wheel失敗,錯誤代碼-11'

Chriss-MacBook-Air:trydjango18 cnowak7$ sudo pip install virtualenv 
The directory '/Users/cnowak7/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. 
The directory '/Users/cnowak7/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. 
Collecting virtualenv 
    Downloading virtualenv-13.1.0-py2.py3-none-any.whl (1.7MB) 
    100% |████████████████████████████████| 1.7MB 120kB/s 
Installing collected packages: virtualenv 
Successfully installed virtualenv-13.1.0 

在此之後,我試圖創建一個虛擬環境,比如在virtualenv .教程和得到這個異常輸出:

Chriss-MacBook-Air:trydjango18 cnowak7$ virtualenv . 
Using base prefix '/Users/cnowak7/anaconda' 
New python executable in ./bin/python3 
Also creating executable in ./bin/python 
Installing setuptools, pip, wheel...done. 
Traceback (most recent call last): 
    File "/Users/cnowak7/anaconda/bin/virtualenv", line 11, in <module> 
    sys.exit(main()) 
    File "/Users/cnowak7/anaconda/lib/python3.4/site-packages/virtualenv.py", line 832, in main 
    symlink=options.symlink) 
    File "/Users/cnowak7/anaconda/lib/python3.4/site-packages/virtualenv.py", line 1004, in create_environment 
    install_wheel(to_install, py_executable, search_dirs) 
    File "/Users/cnowak7/anaconda/lib/python3.4/site-packages/virtualenv.py", line 969, in install_wheel 
    'PIP_NO_INDEX': '1' 
    File "/Users/cnowak7/anaconda/lib/python3.4/site-packages/virtualenv.py", line 910, in call_subprocess 
    % (cmd_desc, proc.returncode)) 
OSError: Command /Users/cnowak7/Deskt...django18/bin/python3 -c "import sys, pip; sys...d\"] + sys.argv[1:]))" setuptools pip wheel failed with error code -11 

於是,我就看看這個錯誤會影響我的教學進度,所以當我跑source bin/activate,我得到這個錯誤:

Chriss-MacBook-Air:trydjango18 cnowak7$ source bin/activate 
-bash: bin/activate: No such file or directory 

我試着卸載並重新安裝了pipvirtualenv,但這個問題依然存在。這可能是因爲我有我的Anaconda文件夾目錄中的每一個?任何幫助或建議,將不勝感激。謝謝。

+0

試試這個:'pip install setuptools --no-use-wheel --upgrade' – doniyor

+0

我試過這個沒有運氣。這是我得到的錯誤: – Rafi

+0

Chriss-MacBook-Air:〜cnowak7 $ pip install setuptools --no-use-wheel --upgrade Traceback(最近調用最後一次): 文件「/ Users/cnowak7/anaconda/bin/pip「,第5行, from pkg_resources import load_entry_point ImportError:沒有名爲'pkg_resources'的模塊 – Rafi

回答

1

我結束了前往www.brew.sh和我的終端運行以下命令來解決這個問題:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" 

從我的理解,它基本上給了我所有的包和庫,我錯過了蘋果d idn't原本給我。我希望這有助於任何遇到同樣問題的人。

0

試試這個:

sudo easy_install pip 

然後:

virtualenv your_virtualenv 
+0

如果我再次安裝pip和virtualenv,我應該先卸載它們嗎? – Rafi

+0

@Rafi是的,更好;) – doniyor

+0

我得到'sudo:apt-get:command not found'。我查了一下,有人說Mac-OSX顯然沒有這個命令。 – Rafi

相關問題