我在Mac OS X 10.6.2(已安装Xcode)和Python 2.6上使用virtualenv-1.4.5。这是我尝试运行virtualenv时得到的结果......
Mac-Pro:pylonsdev paul$ virtualenv --no-site-packages -v trythis
Creating trythis/lib/python2.6
Symlinking Python bootstrap modules
Symlinking trythis/lib/python2.6/_abcoll.pyc
Symlinking trythis/lib/python2.6/_abcoll.pyo
Symlinking trythis/lib/python2.6/abc.pyc
Symlinking trythis/lib/python2.6/abc.pyo
Symlinking trythis/lib/python2.6/codecs.pyc
Symlinking trythis/lib/python2.6/codecs.pyo
Symlinking trythis/lib/python2.6/config
Symlinking trythis/lib/python2.6/copy_reg.pyc
Symlinking trythis/lib/python2.6/copy_reg.pyo
Symlinking trythis/lib/python2.6/encodings
Symlinking trythis/lib/python2.6/fnmatch.pyc
Symlinking trythis/lib/python2.6/fnmatch.pyo
Symlinking trythis/lib/python2.6/genericpath.pyc
Symlinking trythis/lib/python2.6/genericpath.pyo
Symlinking trythis/lib/python2.6/lib-dynload
Symlinking trythis/lib/python2.6/linecache.pyc
Symlinking trythis/lib/python2.6/linecache.pyo
Symlinking trythis/lib/python2.6/locale.pyc
Symlinking trythis/lib/python2.6/locale.pyo
Symlinking trythis/lib/python2.6/ntpath.pyc
Symlinking trythis/lib/python2.6/ntpath.pyo
Symlinking trythis/lib/python2.6/os.pyc
Symlinking trythis/lib/python2.6/os.pyo
Symlinking trythis/lib/python2.6/posixpath.pyc
Symlinking trythis/lib/python2.6/posixpath.pyo
Symlinking trythis/lib/python2.6/re.pyc
Symlinking trythis/lib/python2.6/re.pyo
Symlinking trythis/lib/python2.6/sre.pyc
Symlinking trythis/lib/python2.6/sre.pyo
Symlinking trythis/lib/python2.6/sre_compile.pyc
Symlinking trythis/lib/python2.6/sre_compile.pyo
Symlinking trythis/lib/python2.6/sre_constants.pyc
Symlinking trythis/lib/python2.6/sre_constants.pyo
Symlinking trythis/lib/python2.6/sre_parse.pyc
Symlinking trythis/lib/python2.6/sre_parse.pyo
Symlinking trythis/lib/python2.6/stat.pyc
Symlinking trythis/lib/python2.6/stat.pyo
Symlinking trythis/lib/python2.6/types.pyc
Symlinking trythis/lib/python2.6/types.pyo
Symlinking trythis/lib/python2.6/UserDict.pyc
Symlinking trythis/lib/python2.6/UserDict.pyo
Symlinking trythis/lib/python2.6/warnings.pyc
Symlinking trythis/lib/python2.6/warnings.pyo
Creating trythis/lib/python2.6/site-packages
Writing trythis/lib/python2.6/site.py
Writing trythis/lib/python2.6/orig-prefix.txt
Writing trythis/lib/python2.6/no-global-site-packages.txt
Creating parent directories for trythis/include
Symlinking trythis/include/python2.6
Creating trythis/bin
New python executable in trythis/bin/python
Changed mode of trythis/bin/python to 0755
Symlinking trythis/.Python
Error [Errno 2] No such file or directory while executing command install_name_tool -change /System/Library/Frameworks/Pyt...ython @executable_path/../.Python trythis/bin/python
Could not call install_name_tool -- you must have Apple's development tools installed
Traceback (most recent call last):
File "/usr/local/bin/virtualenv", line 8, in <module>
load_entry_point('virtualenv==1.4.5', 'console_scripts', 'virtualenv')()
File "/Library/Python/2.6/site-packages/virtualenv-1.4.5-py2.6.egg/virtualenv.py", line 529, in main
use_distribute=options.use_distribute)
File "/Library/Python/2.6/site-packages/virtualenv-1.4.5-py2.6.egg/virtualenv.py", line 612, in create_environment
site_packages=site_packages, clear=clear))
File "/Library/Python/2.6/site-packages/virtualenv-1.4.5-py2.6.egg/virtualenv.py", line 806, in install_python
py_executable])
File "/Library/Python/2.6/site-packages/virtualenv-1.4.5-py2.6.egg/virtualenv.py", line 557, in call_subprocess
cwd=cwd, env=env)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/subprocess.py", line 595, in __init__
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/subprocess.py", line 1106, in _execute_child
OSError: [Errno 2] No such file or directory
为什么会抛出此错误的任何建议?
答案 0 :(得分:24)
你真正需要做的就是安装Xcode“命令行工具”,有两种方法可以做到:
1.-如果您已经安装了Xcode,请转到首选项 - &gt;下载并选择“命令行工具”。
2.-从https://developer.apple.com/downloads下载“Xcode的命令行工具”.dmg。
您可以使用App Store安装Xcode,但默认情况下不会包含“命令行工具”。
答案 1 :(得分:12)
从App Store安装XCode以解决问题。我有同样的错误,安装XCode,安装后运行它,现在virtualenv工作。
答案 2 :(得分:4)
嗯,错误消息包括:
你呢?它们位于OSX附带的独立XCode磁盘上。您必须安装Apple的开发工具
答案 3 :(得分:3)
我尝试在安装了XCode的最新Max OSX Lion安装上运行virtualenv时遇到同样的错误消息。
但是:Mark提示on Mar 1 2010:
代码说你还没有安装Xcode,但你说你有。命令行中的install_name_tool说什么?它应该是install_name_tool - &gt; install_name_tool == / usr / bin / install_name_tool
我遇到了同样的问题。我在Lion(10.7.2)中安装了最新的Xcode。
$ locate install_name_tool
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/install_name_tool
/Developer/usr/bin/install_name_tool
/Developer/usr/share/man/man1/install_name_tool.1
我使用
从/ Developer / usr / bin到/ usr / bin创建了一个simlink $ sudo ln -s /Developer/usr/bin/install_name_tool /usr/bin/install_name_tool
输入'which'命令会产生:
$ which install_name_tool
/usr/bin/install_name_tool
之后我做了virtualenv魔术
$ virtualenv -p python2.6 myvirtenv
Running virtualenv with interpreter /opt/local/bin/python2.6
New python executable in myvirtenv/bin/python
Installing setuptools............................done.
Installing pip...............done.
答案 4 :(得分:1)
还有一个关于virtualenv的错误10.6见the ticket on virtualenv's bitbucket。即使你解决了问题,你仍然会遇到另一个问题(我认为没有找到Python.framework的图像,但我不记得了 - 当我碰到这个时我没有记录任何笔记)< / p>
我做了一些调查,我希望用Python 2.7解决问题的根源 - 当然人们都知道它,并向CPython提交补丁来修复它。
然而,似乎有些人在10.6.2和virtualenv 1.4.5中取得了不错的成绩......或者不再使用系统Python(macports,build-by-hand)。
答案 5 :(得分:1)
使用@ gregglind的virtualenv分支有一个解决方案。我在这里回答了同样的问题:mac osx: unable to use virtualenv
git clone https://github.com/gregglind/virtualenv.git
cd virtualenv
git checkout feature/install_name_tool
sudo python setup.py install
答案 6 :(得分:0)
将install_name_tool添加到您的路径
export PATH = $ PATH:/ Developer / usr / bin