1

我正在尝试设置虚拟环境,但出现以下错误:

 $virtualenv ./olp/
New python executable in ./olp/bin/python
Installing setuptools............done.
Installing pip.....
  Complete output from command /home/tom/Documents/Dev/olp/bin/python -x /home/tom/Documents/Dev/olp/bin/easy_install ./pip-X.X.tar.gz:
  Processing pip-X.X.tar.gz
error: Not a recognized archive type: ./pip-X.X.tar.gz
----------------------------------------
...Installing pip...done.
Traceback (most recent call last):
  File "/usr/local/bin/virtualenv", line 9, in <module>
    load_entry_point('virtualenv==1.9.1', 'console_scripts', 'virtualenv')()
  File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 979, in main
    no_pip=options.no_pip)
  File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 1094, 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 667, in install_pip
    filter_stdout=_filter_setup)
  File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 1057, in call_subprocess
    % (cmd_desc, proc.returncode))
OSError: Command /home/tom/Documents/Dev/olp/bin/python -x /home/tom/Documents/Dev/olp/bin/easy_install ./pip-X.X.tar.gz failed with error code 1

然后似乎创建了虚拟环境:

olp$ tree
.
├── bin
│   ├── easy_install
│   ├── easy_install-2.7
│   ├── python
│   ├── python2 -> python
│   └── python2.7 -> python
├── include
│   └── python2.7 -> /usr/include/python2.7
├── lib
│   └── python2.7
│       ├── _abcoll.py -> /usr/lib/python2.7/_abcoll.py
│       ├── _abcoll.pyc
│       ├── abc.py -> /usr/lib/python2.7/abc.py
│       ├── abc.pyc
│       ├── codecs.py -> /usr/lib/python2.7/codecs.py
│       ├── codecs.pyc
│       ├── config -> /usr/lib/python2.7/config
│       ├── copy_reg.py -> /usr/lib/python2.7/copy_reg.py
│       ├── copy_reg.pyc
│       ├── distutils
│       │   ├── distutils.cfg
│       │   ├── __init__.py
│       │   └── __init__.pyc
│       ├── encodings -> /usr/lib/python2.7/encodings
│       ├── fnmatch.py -> /usr/lib/python2.7/fnmatch.py
│       ├── fnmatch.pyc
│       ├── genericpath.py -> /usr/lib/python2.7/genericpath.py
│       ├── genericpath.pyc
│       ├── lib-dynload -> /usr/lib/python2.7/lib-dynload
│       ├── linecache.py -> /usr/lib/python2.7/linecache.py
│       ├── linecache.pyc
│       ├── locale.py -> /usr/lib/python2.7/locale.py
│       ├── no-global-site-packages.txt
│       ├── ntpath.py -> /usr/lib/python2.7/ntpath.py
│       ├── orig-prefix.txt
│       ├── os.py -> /usr/lib/python2.7/os.py
│       ├── os.pyc
│       ├── posixpath.py -> /usr/lib/python2.7/posixpath.py
│       ├── posixpath.pyc
│       ├── re.py -> /usr/lib/python2.7/re.py
│       ├── re.pyc
│       ├── site-packages
│       │   ├── easy-install.pth
│       │   ├── setuptools-0.6c11-py2.7.egg
│       │   └── setuptools.pth
│       ├── site.py
│       ├── site.pyc
│       ├── sre_compile.py -> /usr/lib/python2.7/sre_compile.py
│       ├── sre_compile.pyc
│       ├── sre_constants.py -> /usr/lib/python2.7/sre_constants.py
│       ├── sre_constants.pyc
│       ├── sre_parse.py -> /usr/lib/python2.7/sre_parse.py
│       ├── sre_parse.pyc
│       ├── sre.py -> /usr/lib/python2.7/sre.py
│       ├── stat.py -> /usr/lib/python2.7/stat.py
│       ├── stat.pyc
│       ├── types.py -> /usr/lib/python2.7/types.py
│       ├── types.pyc
│       ├── UserDict.py -> /usr/lib/python2.7/UserDict.py
│       ├── UserDict.pyc
│       ├── warnings.py -> /usr/lib/python2.7/warnings.py
│       ├── warnings.pyc
│       ├── _weakrefset.py -> /usr/lib/python2.7/_weakrefset.py
│       └── _weakrefset.pyc
└── local
    ├── bin -> /home/tom/Documents/Dev/olp/bin
    ├── include -> /home/tom/Documents/Dev/olp/include
    └── lib -> /home/tom/Documents/Dev/olp/lib

谁能帮我解决错误?我做错什么了?

4

1 回答 1

1

我发现了问题所在。当我启动 virtualenv 并且它试图在另一个安装之上安装 pip 时,我似乎不在文件夹内,并且感到困惑......

于 2013-04-03T19:49:42.523 回答