我知道,這個問題已被問及許多次。但是,我仍然無法擺脫這一點。我在我的Mac上發現了以下信息。如何在mac上爲2.7設置python路徑?
cd /Library/Frameworks/Python.framework/Versions/
Current -> 2.7
3.6
whereispython
/usr/bin/python
which python
/usr/bin/python
which -a python
/usr/bin/python
/usr/bin/python
python
Python 2.7.10 (default)
[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
即使這樣,當我編輯~/.bash_profile
如下
# Setting PATH for Python 2.7
# The original version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}"
export PATH
#PYTHONPATH
PYTHONPATH="${PYTHONPATH}:/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python"
export PYTHONPATH
然後,source ~/.bash-profile
。在重新啓動我的終端後,仍然可以看到/usr/bin/python
而不是在執行which python
時指向/Library/../Python2.7
。
我卸載Python和重新安裝"pip install python"
還有,我能看到下/System/Library/Frameworks/Python.framework/Versions
2.6
2.7
2.5 -> 2.6
2.3 -> 2.6
Current -> 2.7
Python安裝我不知道有什麼可以在這裏失蹤。我如何設置/添加mac中的python路徑?請幫助我理解並克服這一點。你能幫我嗎?
參考Adding python path to mac osx
爲什麼不使用類似pyenv的東西? – aristotll
類型python2.7;或'ls/usr/bin | grep python' – AK47