其他分享
首页 > 其他分享> > 在Mountain Lion中的前mkvirtualenv时出错

在Mountain Lion中的前mkvirtualenv时出错

作者:互联网

我有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,

here开始安装

如果你从狮子升级到山狮,由于文件系统的一些变化,python安装被打破,理想情况下你应该从xcode安装命令行工具,然后从python网站安装python,然后从python网站安装setuptools,然后通过easy_install安装pip ,事后一切都会奏效.

标签:python,django,virtualenv,osx-mountain-lion
来源: https://codeday.me/bug/20190901/1786441.html