我讓我的mac osx正常工作,且python 2.7.10
,我已經通過brew install python3
安裝了python3
。Python在安裝3.x時崩潰了
on my bash_profile
然後我創建一個alias python=python3
。
但是當我
>>python3
我:
Your PYTHONPATH points to a site-packages dir for Python 2.x but you are running Python 3.x! PYTHONPATH is currently: "/usr/local/lib/python2.7/site-packages:" You should unset PYTHONPATH to fix this.
然後我跑brew uninstall python3
,但是事情沒來以前的配置,我不能跑也不python
版本了。
>>python
現在給我:
-bash: python3: command not found
我試圖然後brew link python3
,因爲它似乎是有,但都無濟於事。
現在,如果我which python
,我得到:
/usr/local/bin/python
。
我該如何解決這個問題,我希望保持2.7和3.5?
ps。現在我的.bash_profile:
export PATH=「/usr/local/bin:/usr/local/sbin:/usr/bin:~/bin:./bin:$PATH"
"export PYTHONPATH="/usr/local/lib/python2.7/site-packages:$PYTHONPATH"
解決問題的最好方法是使用'虛擬環境',因爲如果您有多個python安裝,這將強制使用python版本。 – Chinny84
我對OSX一無所知,但它們與Windows環境變量類似嗎?只需手動設置PYTHONPATH環境變量。 –
我的答案是否有效?發生了什麼? –