1

我当前的 django 项目需要“virtualenv”。我可以安装它,请求的目录是用一些基本的子目录(bin、include、lib)创建的,但它会停止在让我猜测的错误消息上。所以我希望这里有人知道这个问题,可以帮忙吗?

下面是一些希望有用的控制台文本输出。

提前非常感谢!莉娜

问题描述:

电脑配置:MacOS 10.6.8(雪豹),Python 2.7。

1)创建虚拟环境:

Suesssauer:site-packages sss$ virtualenv --distribute /Users/sss/EclipseProjects/django-projects/DEV
New python executable in /Users/sss/EclipseProjects/django-projects/DEV/bin/python
Please make sure you remove any previous custom paths from your /Users/sss/.pydistutils.cfg file.

COMMENT: fyi – Contents of .pydistutils.cfg
  >> [install] 
  >> install_lib = /Library/Python/$py_version_short/site-packages )

Installing distribute........................................done.
Installing pip....
  Complete output from command /Users/sss/Ecli...DEV/bin/python -x 
  /Users/sss/Ecli...VEL/bin/easy_install         /Library/Python/2.7/...pport/pip-1.1.tar.gz:
  /Users/sss/EclipseProjects/django-projects/DEV/bin/python: 
  can't open file '/Users/sss/EclipseProjects/django-projects/DEV/bin/easy_install': 
  [Errno 2] No such file or directory

评论:这是真的,它不见了。但是手动复制它不是我的工作,不是吗?


...Installing pip...done.
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/2.7/bin/virtualenv", line 8, 
    in <module> load_entry_point('virtualenv==1.7.2', 'console_scripts', 'virtualenv')()
  File "/Library/Python/2.7/site-packages/virtualenv.py", line 942, in main
    never_download=options.never_download)
  File "/Library/Python/2.7/site-packages/virtualenv.py", line 1054, in create_environment
    install_pip(py_executable, search_dirs=search_dirs, never_download=never_download)
  File "/Library/Python/2.7/site-packages/virtualenv.py", line 654, in install_pip
    filter_stdout=_filter_setup)
  File "/Library/Python/2.7/site-packages/virtualenv.py", line 1020, in call_subprocess
    % (cmd_desc, proc.returncode))
OSError: Command /Users/sss/Ecli...ork_DEVEL/bin/python -x /Users/sss/Ecli...VEL/
bin/easy_install   /Library/Python/2.7/...pport/pip-1.1.tar.gz failed with 
error code 2

不知道,文件“/Library/Python/2.7/site-packages/virtualenv_support/pip-1.1.tar.gz”确实存在(如果这是谈论的那个)!

2) 问题:检查 virtualenv 的安装——我是否必须考虑以下这些警告?

控制台输出:

Suesssauer:site-packages sss$ pip install virtualenv
Downloading/unpacking virtualenv
  Downloading virtualenv-1.7.2.tar.gz (2.2Mb): 2.2Mb downloaded
  Running setup.py egg_info for package virtualenv

    warning: no previously-included files matching '*' found under directory 'docs/_templates'
    warning: no previously-included files matching '*' found under directory 'docs/_build'
Installing collected packages: virtualenv
  Running setup.py install for virtualenv

    warning: no previously-included files matching '*' found under directory 'docs/_templates'
    warning: no previously-included files matching '*' found under directory 'docs/_build'
Installing virtualenv script to /Library/Frameworks/Python.framework/Versions/2.7/bin
Installing virtualenv-2.7 script to /Library/Frameworks/Python.framework/Versions/2.7/bin
Successfully installed virtualenv
Cleaning up...

4

2 回答 2

0

这不是您问题的直接解决方案,但我强烈建议您使用 virtualenv-burrito,它是与 virtualenv-wrapper 类一起打包的常用 virtualenv,使组织 virtualenvs 变得更加容易。

Virtualenv-burrtio:https ://github.com/brainsik/virtualenv-burrito

于 2012-08-09T13:57:10.250 回答
0

.pydistutils.cfg在运行之前尝试按照要求“删除”您的文件virtualenv

mv /Users/sss/.pydistutils.cfg /Users/sss/.pydistutils.cfg.old

来源:https ://groups.google.com/forum/#!msg/python-virtualenv/dKZYWuMcI7Y/Z27XXKF5M4sJ

而且我认为错误代码2也是由于easy_install,而不是.tar.gz文件。

于 2012-08-09T14:14:01.463 回答