继续为我的virtualenv获取错误版本的Python

时间:2017-10-03 22:40:43

标签: python python-3.x virtualenv

所以我试图用Python 3.5版创建一个virtualenv。我运行了这个命令virtualenv -p python3.5 myenv并得到了这个:

Running virtualenv with interpreter /usr/bin/python3.5
Using base prefix '/usr'
New python executable in myenv/bin/python3.5
Also creating executable in myenv/bin/python
Please make sure you remove any previous custom paths from your /home/vagrant/.pydistutils.cfg file.
Installing setuptools, pip...done.

但是,当我输入python时,此版本会出现:

Python 3.4.0 (default, Apr 11 2014, 13:05:11) 
[GCC 4.8.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 

我不确定我在这里做错了什么。还有其他人遇到过这个问题吗?

编辑: 尝试source myenv/bin/activate然后python并仍然获得相同的Python版本3.4

1 个答案:

答案 0 :(得分:0)

您没有激活vitualenv。尝试做:

source myenv/bin/activate

并运行

python

有关更多信息,请参阅this post。要更好地了解virtualenv,请参阅this guide