1
系統默認的Python是:我通過brew安裝了python 2.7.3,但virtualenv總是使用2.7.1,爲什麼?
$ /usr/bin/python --version
Python 2.7.1
我$PATH
是
export PATH=/opt/local/bin:/opt/local/sbin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11/bin
我通過homebrew
安裝python 2.7.3
,
$ brew install python --universal --framework
,並將其鏈接,
$ cd /System/Library/Frameworks/Python.framework/Versions
$ sudo mv Current _Current
$ sudo ln -s /usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/Current
,但是當我做一個virtualenv中,它仍然2.7.1
$ python --version
Python 2.7.3
$ virtualenv venv
$ cd venv;source bin/activate
(venv) $ python --version
Python 2.7.1
如何解決呢?
你需要使用virtualenv的'-p'標誌。請參閱http://stackoverflow.com/questions/1534210/use-different-python-version-with-virtualenv – Ghopper21
(或使用python 2.7.3安裝virtualenv,將其添加到/ opt) – geoffspear
「哪個virtualenv'和'哪個python'? – astrofrog