【发布时间】:2017-07-18 15:15:39
【问题描述】:
我需要使用 Python 的 Homebrew 版本,而不是 Python 的系统版本。我全新安装了 macOS Sierra (10.12.5)。
我首先安装了自制软件,然后使用nano ~/.bash_profile 更新了~/.bash_profile。
然后我将它添加到文件中:
# Homebrew
export PATH=/usr/local/bin:$PATH
然后,我需要手动获取 ~/.bash_profile 文件以确保已使用 source ~/.bash_profile 重新加载更改。
我使用brew install python 安装了python,并尝试使用brew linkapps python 进行链接
输出是这样的:
Warning: Already linked: /usr/local/Cellar/python/2.7.13_1
To relink: brew unlink python && brew link python
Gautams-Air:~ gautam$ which python
/usr/bin/python
Gautams-Air:~ gautam$ python -V
Python 2.7.10
Gautams-Air:~ gautam$ brew linkapps python
Warning: brew linkapps has been deprecated and will eventually be removed!
Unfortunately brew linkapps cannot behave nicely with e.g. Spotlight using
either aliases or symlinks and Homebrew formulae do not build "proper" .app
bundles that can be relocated. Instead, please consider using brew cask and
migrate formulae using .app's to casks.
Linking: /usr/local/opt/python/IDLE.app
Linking: /usr/local/opt/python/Python Launcher.app
Linked 2 apps to /Applications`
使用which python 的输出是:
/usr/bin/python
应该是:/usr/local/bin/python
我也尝试过使用:brew unlink python && brew link python
同样使用python -V 它显示Python 2.7.10 尽管Homebrew 中的当前版本是Python 2.7.13
如何使用 Homebrew 版本的 Python 而不是系统版本的 Python? - 如何进行链接?
使用: macOS Sierra (10.12.5)
【问题讨论】:
标签: python-2.7 installation homebrew macos-sierra