简体   繁体   English

virtualenvwrapper似乎忽略了VIRTUALENVWRAPPER_PYTHON

[英]virtualenvwrapper seemingly ignoring VIRTUALENVWRAPPER_PYTHON

I am python / virtualenv n00b, and tried to follow the instructions for installing virtualenv / virtualenvwrapper.sh. 我是python / virtualenv n00b,并尝试按照说明安装virtualenv / virtualenvwrapper.sh。

I installed both virtualenv and virtualenvwrapper.sh via: 我通过以下方式安装了virtualenv和virtualenvwrapper.sh:

pip install virtualenv
pip install virtualenvwrapper

I have python3.5 and python2.7 installed on my system (Mac OS X El Capitan 10.11.4) 我的系统上安装了python3.5和python2.7(Mac OS X El Capitan 10.11.4)

When I search for python, python3, virtualenv and virtualenvwrapper.sh via bash I get the following: 当我通过bash搜索python,python3,virtualenv和virtualenvwrapper.sh时,我得到以下信息:

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

I add the following lines to my .bash_profile: 我将以下行添加到我的.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

source /usr/local/bin/virtualenvwrapper.sh 源/usr/local/bin/virtualenvwrapper.sh

My .bashrc file is essentially empty, and my .profile sources my .bash_profile. 我的.bashrc文件本质上是空的,而我的.profile源于我的.bash_profile。

When I try to use virtualenvwrapper.sh commands (eg, 'mkvirtualenv' and 'lsvirtualenv'), they work, but the default python is still python 2.7. 当我尝试使用virtualenvwrapper.sh命令(例如'mkvirtualenv'和'lsvirtualenv')时,它们可以工作,但是默认的python仍然是python 2.7。

When I run mkvirtualenv -p python3.5 [name], the default python works correctly (ie, python 3.5). 当我运行mkvirtualenv -p python3.5 [name]时,默认python可以正常工作(即python 3.5)。

What am I doing wrong? 我究竟做错了什么? Why is virtualenvwrapper recognizing the specified VIRTUALENVWRAPPER_PYTHON? 为什么virtualenvwrapper可以识别指定的VIRTUALENVWRAPPER_PYTHON?

Thanks in advance for the help. 先谢谢您的帮助。 Really appreciate it 真的很感激

~~~~ I tried: pip3 install virtualenv and got the following error: ~~~~我尝试过: pip3 install virtualenv并出现以下错误:

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

If there is a python3 command, there should be a pip3 command. 如果有python3命令,则应该有pip3命令。 If there is no pip3, pip might only be installed for python 2.x. 如果没有pip3,则只能为python 2.x安装pip。 pip3 will install to python3, pip will install to python. pip3将安装到python3,pip将安装到python。

Try installing virtualenv and virtualenvwrapper with pip3. 尝试使用pip3安装virtualenv和virtualenvwrapper。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM