【发布时间】:2018-01-20 19:32:00
【问题描述】:
我知道,这个问题已经被问过很多次了。但是,我仍然无法摆脱这一点。我在我的 Mac 上发现了以下信息。
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。重新启动我的 mac 和终端后,在执行 which python 时仍然可以看到 /usr/bin/python 而不是指向 /Library/../Python2.7。
我卸载了python并重新安装了"pip install python"
而且,我可以看到 python 安装在/System/Library/Frameworks/Python.framework/Versions
2.6
2.7
2.5 -> 2.6
2.3 -> 2.6
Current -> 2.7
我不确定这里可能缺少什么。如何在 mac 中设置/添加 python 路径?请帮助我理解和克服这一点。你能帮帮我吗?
【问题讨论】:
-
为什么不使用 pyenv 之类的东西?
-
输入哪个python2.7;或'ls /usr/bin | grep python'
标签: python macos python-2.7 add pythonpath