不能在mac上使用Virtualenv了

时间:2012-03-06 17:55:26

标签: python virtualenv

尝试发起新的virtualenv时遇到问题。它突然停止工作,我不知道该怎么做。

这是我尝试创建virtualenv名为" test"时出现的错误。举个例子:

Lucas-Rezendes-MacBook:Desktop lucas$ virtualenv test
New python executable in test/bin/python
install_name_tool: for architecture cputype (16777223) cpusubtype (-2147483645) object: test/bin/python malformed object (unknown load command 4)
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 878, in call_subprocess
    % (cmd_desc, proc.returncode))
OSError: Command install_name_tool -change /System/Library/Fram.../Versions/2.7/Python @executable_path/../.Python test/bin/python failed with error code 1
Lucas-Rezendes-MacBook:Desktop lucas$ 

我今天已经两次重新安装了Xcode(最新版本)! 我也做了#34;哪个python&#34;它重新调整了/ opt / local / bin / python,当我尝试使用&#34; virtualenv -p / opt / local / bin / python test&#34;我收到这个错误:

Lucas-Rezendes-MacBook:bin lucas $ virtualenv -p / opt / local / bin / python test 使用解释器/ opt / local / bin / python运行virtualenv Traceback(最近一次调用最后一次):   文件&#34; /Library/Python/2.7/site-packages/virtualenv-1.7.1.2-py2.7.egg/virtualenv.py" ;,第2270行,     主要()   文件&#34; /Library/Python/2.7/site-packages/virtualenv-1.7.1.2-py2.7.egg/virtualenv.py" ;,第928行,主要     never_download = options.never_download)   文件&#34; /Library/Python/2.7/site-packages/virtualenv-1.7.1.2-py2.7.egg/virtualenv.py",第1029行,在create_environment中     site_packages = site_packages,clear = clear))   文件&#34; /Library/Python/2.7/site-packages/virtualenv-1.7.1.2-py2.7.egg/virtualenv.py" ;,第1154行,在install_python中     MKDIR(LIB_DIR)   文件&#34; /Library/Python/2.7/site-packages/virtualenv-1.7.1.2-py2.7.egg/virtualenv.py" ;,第399行,在mkdir中     os.makedirs(路径)   文件&#34; /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py" ;,第150行,在makedirs中     makedirs(头,模式)   文件&#34; /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py" ;,第150行,在makedirs中     makedirs(头,模式)   文件&#34; /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py" ;,第157行,在makedirs中     mkdir(名称,模式) OSError:[Errno 13]权限被拒绝:&#39; test&#39; Lucas-Rezendes-MacBook:bin lucas $

我真的不知道还能做什么。有人可以帮我吗?提前谢谢!

2 个答案:

答案 0 :(得分:0)

点击此链接:http://blog.cingusoft.org/mac-osx-lion-virtualenv-and-could-not-call-in 从Xcode 4.3.1开始,不会自动安装install_name_tool等命令行工具,因此您必须自己安装。您需要注册一个Apple开发者ID。

答案 1 :(得分:0)

您是否尝试过运行

来安装xcode dev工具
xcode-select –-install