簡體   English   中英

在Mountain Lion中使用mkvirtualenv時出錯

[英]Error when ex mkvirtualenv in Mountain Lion

我有Mountain Lion,我使用這種方法安裝了virtualenv:

sudo easy_install pip
sudo pip install virtualenv virtualenvwrapper
echo "export WORKON_HOME=$HOME/Envs" >> $BASH_CONFIG_FILE
echo "source /usr/local/bin/virtualenvwrapper.sh" >> $BASH_CONFIG_FILE
source ~/.bashrc

當我嘗試使用此命令創建virtualenv時出現問題:

mkvirtualenv test

我收到此錯誤:

New python executable in test/bin/python
Installing setuptools...........
Complete output from command /Users/marco/Envs/test/bin/python -c "#!python
\"\"\"Bootstra...sys.argv[1:])

" /Library/Python/2.7/...ols-0.6c11-py2.7.egg:
Traceback (most recent call last):
File "<string>", line 279, in <module>
File "<string>", line 207, in main
File "/Library/Python/2.7/site-packages/virtualenv_support/setuptools-0.6c11-py2.7.egg/setuptools/__init__.py", line 2, in <module>
File "/Library/Python/2.7/site-packages/virtualenv_support/setuptools-0.6c11-py2.7.egg/setuptools/extension.py", line 1, in <module>
File "/Users/marco/Envs/test/lib/python2.7/distutils/__init__.py", line 16, in <module>
exec(open(os.path.join(distutils_path, '__init__.py')).read())
IOError: [Errno 2] No such file or directory: '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/__init__.py'
----------------------------------------
...Installing setuptools...done.
Traceback (most recent call last):
File "/usr/local/bin/virtualenv", line 8, in <module>
load_entry_point('virtualenv==1.7.2', 'console_scripts', 'virtualenv')()
File "/Library/Python/2.7/site-packages/virtualenv.py", line 942, in main
never_download=options.never_download)
File "/Library/Python/2.7/site-packages/virtualenv.py", line 1052, in create_environment
search_dirs=search_dirs, never_download=never_download)
File "/Library/Python/2.7/site-packages/virtualenv.py", line 598, in install_setuptools
search_dirs=search_dirs, never_download=never_download)
File "/Library/Python/2.7/site-packages/virtualenv.py", line 570, in _install_req
cwd=cwd)
File "/Library/Python/2.7/site-packages/virtualenv.py", line 1020, in call_subprocess
% (cmd_desc, proc.returncode))
OSError: Command /Users/marco/Envs/test/bin/python -c "#!python
\"\"\"Bootstra...sys.argv[1:])
" /Library/Python/2.7/...ols-0.6c11-py2.7.egg failed with error code 1

你能幫助我嗎?

謝謝! 標記

您沒有安裝setuptools,

這里安裝它

如果你從獅子升級到山獅,由於文件系統的一些變化,python安裝會被破壞,理想情況下你應該從xcode安裝命令行工具,然后從python網站安裝python,然后從python網站安裝setuptools,然后通過easy_install安裝pip ,事后一切都會奏效。

問題解決了:

Xcode 4不會自動安裝命令行工具。

基本上,安裝Xcode,進入首選項,然后下載並安裝“命令行工具”。 它現在有效。

:)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM