Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 在Mac OS X上运行Virtualenv时出现问题_Python_Macos_Virtualenv - Fatal编程技术网

Python 在Mac OS X上运行Virtualenv时出现问题

Python 在Mac OS X上运行Virtualenv时出现问题,python,macos,virtualenv,Python,Macos,Virtualenv,我在MacOSX10.6.2(安装了Xcode)和Python2.6上使用virtualenv-1.4.5。以下是我尝试运行虚拟电视时得到的结果 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.p

我在MacOSX10.6.2(安装了Xcode)和Python2.6上使用virtualenv-1.4.5。以下是我尝试运行虚拟电视时得到的结果

 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
Mac-Pro:pylonsdev-paul$virtualenv——无站点包-v trythis
创建trythis/lib/python2.6
符号链接Python引导模块
符号链接trythis/lib/python2.6//u abcoll.pyc
符号链接trythis/lib/python2.6//u abcoll.pyo
符号链接trythis/lib/python2.6/abc.pyc
符号链接trythis/lib/python2.6/abc.pyo
符号链接trythis/lib/python2.6/codecs.pyc
符号链接trythis/lib/python2.6/codecs.pyo
符号链接trythis/lib/python2.6/config
符号链接trythis/lib/python2.6/copy_reg.pyc
符号链接trythis/lib/python2.6/copy_reg.pyo
符号链接trythis/lib/python2.6/encodings
符号链接trythis/lib/python2.6/fnmatch.pyc
符号链接trythis/lib/python2.6/fnmatch.pyo
符号链接trythis/lib/python2.6/genericpath.pyc
符号链接trythis/lib/python2.6/genericpath.pyo
符号链接trythis/lib/python2.6/lib-dynload
符号链接trythis/lib/python2.6/linecache.pyc
符号链接trythis/lib/python2.6/linecache.pyo
符号链接trythis/lib/python2.6/locale.pyc
符号链接trythis/lib/python2.6/locale.pyo
符号链接trythis/lib/python2.6/ntpath.pyc
符号链接trythis/lib/python2.6/ntpath.pyo
符号链接trythis/lib/python2.6/os.pyc
符号链接trythis/lib/python2.6/os.pyo
符号链接trythis/lib/python2.6/posixpath.pyc
符号链接trythis/lib/python2.6/posixpath.pyo
符号链接trythis/lib/python2.6/re.pyc
符号链接trythis/lib/python2.6/re.pyo
符号链接trythis/lib/python2.6/sre.pyc
符号链接trythis/lib/python2.6/sre.pyo
符号链接trythis/lib/python2.6/sre_compile.pyc
符号链接trythis/lib/python2.6/sre_compile.pyo
符号链接trythis/lib/python2.6/sre_constants.pyc
符号链接trythis/lib/python2.6/sre_constants.pyo
符号链接trythis/lib/python2.6/sre_parse.pyc
符号链接trythis/lib/python2.6/sre_parse.pyo
符号链接trythis/lib/python2.6/stat.pyc
符号链接trythis/lib/python2.6/stat.pyo
符号链接trythis/lib/python2.6/types.pyc
符号链接trythis/lib/python2.6/types.pyo
符号链接trythis/lib/python2.6/UserDict.pyc
符号链接trythis/lib/python2.6/UserDict.pyo
符号链接trythis/lib/python2.6/warnings.pyc
符号链接trythis/lib/python2.6/warnings.pyo
创建trythis/lib/python2.6/site-packages
编写trythis/lib/python2.6/site.py
编写trythis/lib/python2.6/orig-prefix.txt
编写trythis/lib/python2.6/no-global-site-packages.txt
为trythis/include创建父目录
符号链接trythis/include/python2.6
创建trythis/bin
trythis/bin/python中的新python可执行文件
将trythis/bin/python的模式更改为0755
符号链接trythis/.Python
错误[Errno 2]执行命令install\u name\u tool-change/System/Library/Frameworks/Pyt…ython@executable\u path/./.Python trythis/bin/Python时没有这样的文件或目录
无法调用install\u name\u tool--您必须安装Apple的开发工具
回溯(最近一次呼叫最后一次):
文件“/usr/local/bin/virtualenv”,第8行,在
加载入口点('virtualenv==1.4.5','console\u scripts','virtualenv')()
文件“/Library/Python/2.6/site packages/virtualenv-1.4.5-py2.6.egg/virtualenv.py”,第529行,在main中
使用分布=选项。使用分布)
文件“/Library/Python/2.6/site packages/virtualenv-1.4.5-py2.6.egg/virtualenv.py”,第612行,在create_环境中
站点\包=站点\包,清除=清除)
文件“/Library/Python/2.6/site packages/virtualenv-1.4.5-py2.6.egg/virtualenv.py”,第806行,在install_Python中
py_可执行文件])
call_子流程中的文件“/Library/Python/2.6/site packages/virtualenv-1.4.5-py2.6.egg/virtualenv.py”,第557行
cwd=cwd,env=env)
文件“/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/subprocess.py”,第595行,在__
文件“/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/subprocess.py”,第1106行,在执行子进程中
OSError:[Errno 2]没有这样的文件或目录

是否有任何关于抛出此错误的建议?

嗯,错误消息包括:

您必须安装Apple的开发工具


你知道吗?它们位于OSX附带的单独的XCode磁盘上。

10.6版本上的virtualenv也有一个bug,请参阅。即使您解决了当前的问题,您仍然会遇到另一个问题(我认为在Python.framework中找不到图像,但我不记得了-遇到此问题时,我没有做任何笔记)

我对此做了一些调查,我希望Python2.7能够解决问题的根源——人们当然知道这一点,并向CPython提交了一个补丁来修复它


然而,似乎有些人在10.6.2和VirtualNV 1.4.5中取得了很好的效果。。。或者不再使用系统Python(macports,手工构建)。

从应用商店安装XCode以解决问题。我也犯了同样的错误,安装了XCode,安装后运行了它,现在virtualenv可以工作了。

使用@gregglind的virtualenv分支可以解决这个问题。我在这里回答了同样的问题:


在安装了XCode的最新Max OSX Lion安装上运行virtualenv时,我收到了相同的错误消息

但是:标记提示:


代码上说你们并没有安装Xcode,但你们说你们已经安装了。命令行中的哪个install_name_工具说明了什么?它应该是install_name_tool->install_name_tool==/usr/bin/install_name_tool

我也有同样的问题。我在Lion(10.7.2)中安装了最新的Xcode

我使用创建了一个从/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 -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.

将安装名称工具添加到路径中


export PATH=$PATH:/Developer/usr/bin

您真正需要做的就是安装Xcode“命令行工具”,有两种方法:

1.-如果您已经安装了Xcode,请转到
 $ which install_name_tool
 /usr/bin/install_name_tool
$ 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.