一个奇怪的virtualenv问题 - 即使用-p它安装多个蟒蛇

时间:2015-07-12 16:23:51

标签: python virtualenv

我正在尝试使用3.4创建虚拟环境。我已经按照通过搜索stackoverflow找到的指令,以及在reddit上发布此问题,并继续遇到同样的问题:即使我指定python3.4,它也安装3.4和2.7。这就导致了我试图通过首先使用虚拟环境来避免的所有问题。

if 'access_token' in request.session.keys():
     access_token = request.session['access_token']

当我查看venv / bin文件夹时,它具有2.7.9和3.4的二进制文件。

激活环境后

$ which python3
/Library/Frameworks/Python.framework/Versions/3.4/bin/python3
$ mkdir test
$ cd test
$ virtualenv -p /Library/Frameworks/Python.framework/Versions/3.4/bin/python3.4 venv
(various output saying it's creating venv/bin/python with 3.4)
$ source venv/bin/activate
(venv)$ python --version
Python 2.7.9

reddit上的一个人建议尝试使用venv:

$ echo $PATH
/Users/theinevitable/Documents/python/test/venv/bin:/Library/Frameworks/Python.framework/Versions/3.4/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/Library/Frameworks/Python.framework/Versions/3.4/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Applications/Postgres.app/Contents/Versions/9.4/bin

$ which python
/Users/theinevitable/Documents/python/test/venv/bin/python
$ which python3
/Library/Frameworks/Python.framework/Versions/3.4/bin/python3

0 个答案:

没有答案