virtualenvwrapper似乎忽略了VIRTUALENVWRAPPER_PYTHON [英] virtualenvwrapper seemingly ignoring VIRTUALENVWRAPPER_PYTHON

查看:92
本文介绍了virtualenvwrapper似乎忽略了VIRTUALENVWRAPPER_PYTHON的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是python/virtualenv n00b,并尝试按照说明安装virtualenv/virtualenvwrapper.sh.

I am python / virtualenv n00b, and tried to follow the instructions for installing virtualenv / virtualenvwrapper.sh.

我通过以下方式安装了virtualenv和virtualenvwrapper.sh:

I installed both virtualenv and virtualenvwrapper.sh via:

pip install virtualenv
pip install virtualenvwrapper

我的系统上安装了python3.5和python2.7(Mac OS X El Capitan 10.11.4)

I have python3.5 and python2.7 installed on my system (Mac OS X El Capitan 10.11.4)

当我通过bash搜索python,python3,virtualenv和virtualenvwrapper.sh时,我得到以下信息:

When I search for python, python3, virtualenv and virtualenvwrapper.sh via bash I get the following:

which python ==> /usr/local/bin/python
which python3 ==> /usr/local/bin/python3
which virtualenv ==> /usr/local/bin/virtualenv
which virtualenvwrapper.sh ==> /usr/local/bin/virtualenvwrapper.sh

我在.bash_profile中添加以下行:

I add the following lines to my .bash_profile:

export PATH=/usr/local/bin:$PATH
export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python3.5
export WORKON_HOME=$HOME/.virtualenvs
export PROJECT_HOME=$HOME/Devel

源代码/usr/local/bin/virtualenvwrapper.sh

source /usr/local/bin/virtualenvwrapper.sh

我的.bashrc文件本质上是空的,而我的.profile源于我的.bash_profile.

My .bashrc file is essentially empty, and my .profile sources my .bash_profile.

当我尝试使用virtualenvwrapper.sh命令(例如'mkvirtualenv'和'lsvirtualenv')时,它们可以工作,但是默认的python仍然是python 2.7.

When I try to use virtualenvwrapper.sh commands (e.g., 'mkvirtualenv' and 'lsvirtualenv'), they work, but the default python is still python 2.7.

当我运行mkvirtualenv -p python3.5 [name]时,默认的python可以正常工作(即python 3.5).

When I run mkvirtualenv -p python3.5 [name], the default python works correctly (i.e., python 3.5).

我做错了什么?为什么virtualenvwrapper可以识别指定的VIRTUALENVWRAPPER_PYTHON?

What am I doing wrong? Why is virtualenvwrapper recognizing the specified VIRTUALENVWRAPPER_PYTHON?

预先感谢您的帮助.真的很感激

Thanks in advance for the help. Really appreciate it

~~~~ 我试过了: pip3 install virtualenv 并出现以下错误:

~~~~ I tried: pip3 install virtualenv and got the following error:

Traceback (most recent call last):
File "/usr/local/bin/pip3", line 5, in <module>
from pkg_resources import load_entry_point
File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 3138, in <module>
@_call_aside
File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 3124, in _call_aside
f(*args, **kwargs)
File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 3151, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 663, in _build_master
return cls._build_from_requirements(__requires__)
File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 676, in _build_from_requirements
dists = ws.resolve(reqs, Environment())
File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 849, in resolve raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'pip==8.0.2' distribution was  
not found and is required by the application

推荐答案

如果有python3命令,则应该有pip3命令.如果没有pip3,则可能仅为python 2.x安装了pip. pip3将安装到python3,pip将安装到python.

If there is a python3 command, there should be a pip3 command. If there is no pip3, pip might only be installed for python 2.x. pip3 will install to python3, pip will install to python.

尝试通过pip3安装virtualenv和virtualenvwrapper.

Try installing virtualenv and virtualenvwrapper with pip3.

这篇关于virtualenvwrapper似乎忽略了VIRTUALENVWRAPPER_PYTHON的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆