无法调用install_name_tool

时间:2011-09-22 00:04:23

标签: python xcode virtualenv

尝试在10.7上使用virutalenv版本1.6.4(最新撰写本文),在Mac应用程序商店安装了带有Xcode 4的Lion,但我收到以下错误消息:

New python executable in SUPENV/bin/python
Error [Errno 2] No such file or directory while executing command install_name_tool -change /System/Library/Fram.../Versions/2.7/Python @executable_path/../.Python SUPENV/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.6.4', 'console_scripts', 'virtualenv')()
  File "/Library/Python/2.7/site-packages/virtualenv-1.6.4-py2.7.egg/virtualenv.py", line 810, in main
never_download=options.never_download)
  File "/Library/Python/2.7/site-packages/virtualenv-1.6.4-py2.7.egg/virtualenv.py", line 901, in create_environment
site_packages=site_packages, clear=clear))
  File "/Library/Python/2.7/site-packages/virtualenv-1.6.4-py2.7.egg/virtualenv.py", line 1166, in install_python
py_executable])
  File "/Library/Python/2.7/site-packages/virtualenv-1.6.4-py2.7.egg/virtualenv.py", line 843, in call_subprocess
cwd=cwd, env=env)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 672, in __init__
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1202, in _execute_child
OSError: [Errno 2] No such file or directory

有关如何解决此问题的任何提示......我想第一个是检查我的系统上是否存在install_name_tool,然后强制virtualenv使用它......

提前感谢!

3 个答案:

答案 0 :(得分:10)

您需要同时安装XCode,运行它,并选择可选的“命令行工具”包,然后安装它们。更详细:

  • 从App Store下载XCode
  • 从“应用程序”或“启动板”
  • 运行下载的XCode二进制文件
  • 选择XCode-&gt;偏好设置,然后选择“下载”标签
  • 单击“命令行工具”选项并安装

答案 1 :(得分:4)

你真的安装了Xcode 4吗?从App Store下载它只会为其下载安装程序。然后你需要运行安装程序;您应该找到下载到/Applications的安装程序。运行后,您应该在这里找到install_name_tool

$ which install_name_tool
/usr/bin/install_name_tool

答案 2 :(得分:0)

使用较新版本的virtualenv(至少从1.8.4开始),不再需要从Xcode安装“命令行工具”包。