每当我创建一个项目时,我总是使用virtualenv
来开发环境(Python3.x)。在这个时候,我试图将环境设置为Python2.x,但不起作用。这是我做的:
(Mac OS Yosemitie,virtualenv版本14.0.1,python3版本3.5.1,python2版本2.7.10)
$ cd `certain empty directory`
$ virtualenv --python=python2.7 venv
$ . venv/bin/activate
(venv)$ python
Python 3.5.1 (v3.5.1:37a07cee5969, Dec 5 2015, 21:12:44)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
我不明白为什么python版本是3.5.1 当我输入时,
(venv)$ which python
/Users/Chois/Desktop/Programming/Project/chois_pystagram/venv/bin/python
(venv)$ cd /Users/Chois/Desktop/Programming/Project/chois_pystagram/venv/bin
(venv)$ ls
activate activate_this.py pip python python2.7
activate.csh easy_install pip2 python-config wheel
activate.fish easy_install-2.7 pip2.7 python2
所有python
都是2.7版
我该如何解决?