升级到Lion后如何让virtualenv工作? [英] How to get virtualenv to work after upgrading to Lion?

查看:50
本文介绍了升级到Lion后如何让virtualenv工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚从 SnowLeapord 升级到 Lion,现在无法创建虚拟环境.我知道升级后有新的 Python 安装并且没有站点包,并尝试再次安装 pip 和 virtualenv 以及升级到 Xcode4,但我总是收到此错误:

I just upgraded from SnowLeapord to Lion and now cannot create virtualenvs. I understand that there are new Python installations after the upgrade and no site packages and have tried installing pip and virtualenv again as well as upgrading to Xcode4 but I always get this error:

~ > virtualenv --distribute env
New python executable in env/bin/python
Installing distribute........
Complete output from command /Users/jaderberg/env/bin/python -c "#!python
\"\"\"Bootstra... main(sys.argv[1:])
" --always-copy -U distribute:
Traceback (most recent call last):
File "<string>", line 23, in <module>
File "/Users/jaderberg/env/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 distribute...done.
Traceback (most recent call last):
File "/usr/local/bin/virtualenv", line 9, in <module>
load_entry_point('virtualenv==1.7.2', 'console_scripts', 'virtualenv')()
File "/Library/Python/2.7/site-packages/virtualenv-1.7.2-py2.7.egg/virtualenv.py", line 942, in main
never_download=options.never_download)
File "/Library/Python/2.7/site-packages/virtualenv-1.7.2-py2.7.egg/virtualenv.py", line 1049, in create_environment
search_dirs=search_dirs, never_download=never_download)
File "/Library/Python/2.7/site-packages/virtualenv-1.7.2-py2.7.egg/virtualenv.py", line 603, in install_distribute
search_dirs=search_dirs, never_download=never_download)
File "/Library/Python/2.7/site-packages/virtualenv-1.7.2-py2.7.egg/virtualenv.py", line 570, in _install_req
cwd=cwd)
File "/Library/Python/2.7/site-packages/virtualenv-1.7.2-py2.7.egg/virtualenv.py", line 1020, in call_subprocess
% (cmd_desc, proc.returncode))
OSError: Command /Users/jaderberg/env/bin/python -c "#!python
\"\"\"Bootstra... main(sys.argv[1:])
" --always-copy -U distribute failed with error code 1

我是一个 unix/python 新手,只是不知道如何让它工作.有任何想法吗?如果不使用 --distribute 标记,我会收到此错误:

I am a bit of a unix/python novice and just cannot work out how to get this working. Any ideas? Without using the --distribute tag I get this error:

~ > virtualenv env
New python executable in env/bin/python
Installing setuptools.............
  Complete output from command /Users/jaderberg/env/bin/python -c "#!python
\"\"\"Bootstra...sys.argv[1:])






" /Library/Python/2.7/...ols-0.6c11-py2.7.egg:
  Traceback (most recent call last):
  File "", line 279, in 
  File "", line 207, in main
  File "/Library/Python/2.7/site-packages/distribute-0.6.27-py2.7.egg/setuptools/__init__.py", line 2, in 
    from setuptools.extension import Extension, Library
  File "/Library/Python/2.7/site-packages/distribute-0.6.27-py2.7.egg/setuptools/extension.py", line 2, in 
    import distutils.core
  File "/Users/jaderberg/env/lib/python2.7/distutils/__init__.py", line 16, in 
    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 9, in 
    load_entry_point('virtualenv==1.7.2', 'console_scripts', 'virtualenv')()
  File "/Library/Python/2.7/site-packages/virtualenv-1.7.2-py2.7.egg/virtualenv.py", line 942, in main
    never_download=options.never_download)
  File "/Library/Python/2.7/site-packages/virtualenv-1.7.2-py2.7.egg/virtualenv.py", line 1052, in create_environment
    search_dirs=search_dirs, never_download=never_download)
  File "/Library/Python/2.7/site-packages/virtualenv-1.7.2-py2.7.egg/virtualenv.py", line 598, in install_setuptools
    search_dirs=search_dirs, never_download=never_download)
  File "/Library/Python/2.7/site-packages/virtualenv-1.7.2-py2.7.egg/virtualenv.py", line 570, in _install_req
    cwd=cwd)
  File "/Library/Python/2.7/site-packages/virtualenv-1.7.2-py2.7.egg/virtualenv.py", line 1020, in call_subprocess
    % (cmd_desc, proc.returncode))
OSError: Command /Users/jaderberg/env/bin/python -c "#!python
\"\"\"Bootstra...sys.argv[1:])


" /Library/Python/2.7/...ols-0.6c11-py2.7.egg failed with error code 1

推荐答案

事实证明,虽然我将 Xcode 升级到版本 4,但它并没有自动安装命令行工具.我跟着这个 http://blog.cingusoft.org/mac-osx-lion-virtualenv-and-could-not-call-in.

Turns out that although I upgraded Xcode to version 4, it does not automatically install the command line tools. I followed this http://blog.cingusoft.org/mac-osx-lion-virtualenv-and-could-not-call-in.

基本上,安装 Xcode,进入首选项,然后下载并安装命令行工具".现在可以使用了.

Basically, install Xcode, go into Preferences and then Downloads and install "Command Line Tools". It works now.

命令行工具也可直接从 https://developer.apple.com 获得/downloads/index.action#

The Command Line Tools are also available directly from https://developer.apple.com/downloads/index.action#

这篇关于升级到Lion后如何让virtualenv工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆