Virtualenv返回'没有这样的文件或目录...'错误

时间:2012-04-09 02:49:37

标签: python virtualenv

命令virtualenv --no-site-packages env/生成以下错误堆栈跟踪:

    The --no-site-packages flag is deprecated; it is now the default behavior.
New python executable in env/bin/python
Installing setuptools.............done.
Installing pip...
  Error [Errno 2] No such file or directory while executing command /home/zach/School/CS...env/bin/easy_install /usr/local/lib/pytho...pport/pip-1.1.tar.gz
...Installing pip...done.
Traceback (most recent call last):
  File "/usr/local/bin/virtualenv", line 9, in <module>
    load_entry_point('virtualenv==1.7.1.2', 'console_scripts', 'virtualenv')()
  File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 928, in main
    never_download=options.never_download)
  File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 1042, in create_environment
    install_pip(py_executable, search_dirs=search_dirs, never_download=never_download)
  File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 640, in install_pip
    filter_stdout=_filter_setup)
  File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 966, in call_subprocess
    cwd=cwd, env=env)
  File "/usr/lib/python2.7/subprocess.py", line 679, in __init__
    errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1239, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

我使用的是Ubuntu 11.10和Python 2.7。

编辑: 想出来了。

我最初用pip安装它,所以我通过pip卸载并通过apt-get重新安装。

5 个答案:

答案 0 :(得分:6)

virtualenv希望尝试使用本地存档中的easy_install来安装pip。您能否验证它是否存在于/usr/local/lib/pytho...pport/pip-1.1.tar.gz

您可能需要确保预先正确安装pip。首先尝试:easy_install -U pip

答案 1 :(得分:4)

我对debian也有同样的看法。升级python-virtualenv可以解决问题。

apt-get upgrade python-virtualenv

答案 2 :(得分:1)

在mac run pip install virtualenv virtualenvwrapper中安装virtualenv。

答案 3 :(得分:0)

您应该确保easy_install的路径中没有空格:/ home / zach / School / CS ... env / bin / easy_install

答案 4 :(得分:0)

如果您是 Debian 用户,那么此命令应该可以解决问题:

sudo apt-get upgrade python-virtualenv