我需要使用Python的Homebrew版本而不是系統版本的Python。我有一個乾淨的安裝macOS Sierra(10.12.5)。安裝自制Python和鏈接
我首先安裝了自制軟件,然後使用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
雖然目前的版本是家釀Python 2.7.13
我如何使用Python的家釀版本,而不是Python中的系統版本? - 我該如何做鏈接?
使用: MacOS的塞拉(10.12.5)
[在OS X上使用Python與自制軟件](http://stackoverflow.com/q/25441252) – jww