编程语言
首页 > 编程语言> > python – 为什么我在尝试设置virtualenv时会收到此错误(与pip和easy_install相关)?

python – 为什么我在尝试设置virtualenv时会收到此错误(与pip和easy_install相关)?

作者:互联网

我正在尝试创建一个Flask应用程序来推送到Heroku.当我尝试在文件夹中创建virtualenv时,我抛出了这个错误:

photo-crawl › sudo virtualenv venv --distribute
Password:
New python executable in venv/bin/python
Installing distribute............................................................................................................................................................................................................................done.
Installing pip....
  Complete output from command /Users/evansiegel/In...rawl/venv/bin/python -x /Users/evansiegel/In...env/bin/easy_install /Library/Python/2.7/...ort/pip-1.2.1.tar.gz:
  /Users/evansiegel/Involvio/photo-crawl/venv/bin/python: can't open file '/Users/evansiegel/Involvio/photo-crawl/venv/bin/easy_install': [Errno 2] No such file or directory
----------------------------------------
...Installing pip...done.
Traceback (most recent call last):
  File "/usr/local/bin/virtualenv", line 9, in <module>
    load_entry_point('virtualenv==1.8.4', 'console_scripts', 'virtualenv')()
  File "/Library/Python/2.7/site-packages/virtualenv.py", line 964, in main
    never_download=options.never_download)
  File "/Library/Python/2.7/site-packages/virtualenv.py", line 1076, 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 667, in install_pip
    filter_stdout=_filter_setup)
  File "/Library/Python/2.7/site-packages/virtualenv.py", line 1042, in call_subprocess
    % (cmd_desc, proc.returncode))
OSError: Command /Users/evansiegel/In...rawl/venv/bin/python -x /Users/evansiegel/In...env/bin/easy_install /Library/Python/2.7/...ort/pip-1.2.1.tar.gz failed with error code 2

似乎由于某种原因,virtualenv没有把它应该放入venv / bin文件夹的所有内容.现在,只有python和两个别名,python2和python2.7在那里.

谢谢!

解决方法:

我相信这是由旧版virtualenv和/或pip中的错误引起的.看起来你正在使用virtualenv 1.8.4和pip 1.2.1.你有可能升级到最新的virtualenv和pip(目前virtualenv 1.9.1和pip 1.3.1)?

如果你有安装权限,这应该这样做:

pip install pip --upgrade
pip install virtualenv --upgrade

此时运行相同的命令(即sudo virtualenv venv –distribute)应该给你你想要的.

标签:python,pip,easy-install,virtualenv,flask
来源: https://codeday.me/bug/20190625/1286529.html