Tôi cần sử dụng phiên bản Homebrew của Python thay vì phiên bản hệ thống của Python. Tôi có một cài đặt sạch của macOS Sierra (10.12.5).Cài đặt Homebrew Python và liên kết
Lần đầu tiên tôi cài đặt homebrew và sau đó được cập nhật ~/.bash_profile
sử dụng nano ~/.bash_profile
. Sau đó, tôi thêm này vào tệp:
# Homebrew
export PATH=/usr/local/bin:$PATH
Sau đó, tôi cần phải tự tìm nguồn tập tin ~/.bash_profile
để đảm bảo những thay đổi đã được nạp lại sử dụng source ~/.bash_profile
.
Tôi đã cài đặt python sử dụng brew install python
và cố gắng liên kết sử dụng brew linkapps python
Sản lượng nhiên, đây:
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`
Sử dụng which python
đầu ra là: /usr/bin/python
Nó cần phải có được: /usr/local/bin/python
Tôi cũng đã thử sử dụng: brew unlink python && brew link python
Cũng sử dụng python -V
nó cho thấy Python 2.7.10
mặc dù phiên bản hiện tại trong Homebrew là Python 2.7.13
Làm thế nào để sử dụng phiên bản Homebrew của Python thay vì phiên bản hệ thống của Python? - Làm cách nào để liên kết?
SỬ DỤNG: MacOS Sierra (10.12.5)
[Sử dụng Python với homebrew trên OS X] (http://stackoverflow.com/q/25441252) – jww