Upgrading Python to 2.7 on OSX
How can I upgrade Python from 2.6 to 2.7开发者_如何学C on osx ?
There's an installer for it here.
Visit this website and download the latest version for OS X (2.7.9 or 3.4.2) that you want. https://www.python.org/downloads/
Now open the DMG and execute the installer... this (Python.mpkg) will install the Python release into /Library/Frameworks/Python.framework, which is not what we want, as the previously installed Python versions in /usr/bin/python may lead to some nasty incompatibilities. So in other words some work still needs to be done to really update Python on your Mac.
- Open a terminal and enter: sudo rm -R /System/Library/Frameworks/Python.framework/Versions/2.7 This will delete previously installed versions of Python 2.7.x
- Now enter this into the terminal: sudo mv /Library/Frameworks/Python.framework/Versions/2.7 /System/Library/Frameworks/Python.framework/Versions which moves the newly installed python 2.7.9 release next to the previous Python releases.
Further steps can be found here: http://wolfpaulus.com/jounal/mac/installing_python_osx/
Install Mac Ports. It has a Python 2.7 port.
sudo port install python27
Homebrew also has a Python 2.7 port.
brew install python
python 2.7 is bundled with OS X Mountain Lion (10.8) and onwards, so it is likely that most Macs running today (2018) will have python 2.7 without any further effort.
精彩评论