在Mac OS 10.12.6中将python 2更改为python 3

时间:2019-01-29 03:27:27

标签: python-3.x macos python-2.7 pip homebrew

我正在尝试将路径从python 2.x更改为python 3.x,但是我的系统始终使用版本2.x

我安装了python 3.7和最新版本的homebrew。但是我的系统只是没有使用3.7版的新PATH

下面显示了我的bash_profile,并根据https://docs.python-guide.org/starting/install3/osx/

的建议更新了最后一行
# Setting PATH for Python 3.6
# The original version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.6/bin:${PATH}"
export PATH

# Setting PATH for Python 3.6   
# The original version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.6/bin:${PATH}"
export PATH  

# added by Anaconda3 5.0.1 installer
export PATH="/Users/omnidevio/anaconda3/bin:$PATH"

# 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

# Setting PATH for Python 3.7
# The original version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.7/bin:${PATH}"
export PATH=/usr/local/bin:/usr/local/sbin:$PATH

当我运行“ python --version”时,它仅显示2.x

Python 2.7.15

我尝试将pip更新到版本19,但是它使用“ pip install --upgrade pip”使用了python 2.7的旧版本10,但是得到了以下信息:

Collecting pip
 Using cached 

https://files.pythonhosted.org/packages/46/dc/7fd5df840efb3e56c8b4f768793a237ec4ee59891959d6a215d63f727023/pip-19.0.1-py2.py3-none-any.whl

matplotlib 1.3.1 requires nose, which is not installed.
matplotlib 1.3.1 requires tornado, which is not installed.
Installing collected packages: pip
  Found existing installation: pip 10.0.1
    Uninstalling pip-10.0.1:
Could not install packages due to an EnvironmentError: [Errno 13] 
Permission denied: '/Library/Python/2.7/site-packages/pip-10.0.1- 
py2.7.egg/EGG-INFO/dependency_links.txt'
Consider using the `--user` option or check the permissions.

You are using pip version 10.0.1, however version 19.0.1 is 
available.
You should consider upgrading via the 'pip install --upgrade pip' 
command.

0 个答案:

没有答案