Install Python 3 on Mac OSX - 通達人驛站
2015/10/1

Install Python 3 on Mac OSX

I have installed Python 2.x on Mac OSX. The detailed please refer to this link. However I also need to learn Python 3.x on Mac OSX. So I find the way to install Python 3.x on Mac OSX.

Check the available python-related packages to install


Type below command to check the available python-related packages to install.
$ brew search python
Example
JosedeMBP:bin sunjose$ brew search python
boost-python python wxpython
gst-python python3 zpython
Caskroom/cask/mod_python homebrew/versions/gst-python010
homebrew/python/python-dbus Caskroom/cask/python
homebrew/python/vpython Caskroom/cask/python3


Install python3 by brew


You can install python 3 by brew.
$ brew install python3
Example
JosedeMBP:bin sunjose$ brew install python3
==> Downloading https://homebrew.bintray.com/bottles/python3-3.4.3_2.yosemite.bo
######################################################################## 100.0%
==> Pouring python3-3.4.3_2.yosemite.bottle.tar.gz
==> Caveats
Pip and setuptools have been installed. To update them
pip3 install --upgrade pip setuptools

You can install Python packages with
pip3 install <package>

They will install into the site-package directory
/usr/local/lib/python3.4/site-packages

See: https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/Homebrew-and-Python.md


.app bundles were installed.
Run `brew linkapps python3` to symlink these to /Applications.
==> /usr/local/Cellar/python3/3.4.3_2/bin/python3 -s setup.py --no-user-cfg inst
==> /usr/local/Cellar/python3/3.4.3_2/bin/python3 -s setup.py --no-user-cfg inst
==> /usr/local/Cellar/python3/3.4.3_2/bin/python3 -s setup.py --no-user-cfg inst
==> Summary
🍺 /usr/local/Cellar/python3/3.4.3_2: 4696 files, 79M


Create symlink to /Applications


Create symlink to /Applications.
$ brew linkapps python3
Example
JosedeMBP:bin sunjose$ brew linkapps python3
Linking /usr/local/opt/python3/IDLE 3.app to /Applications.
Linking /usr/local/opt/python3/Python Launcher 3.app to /Applications.


Check installed python version


Check which version is installed by --version
$ python3 --version
Example
JosedeMBP:bin sunjose$ python3 --version
Python 3.4.3
JosedeMBP:bin sunjose$ python --version
Python 2.7.10


Update pip3 setuptools


You could update pip3 setuptools by below commands.
$ pip3 install --upgrade pip setuptools
Example
JosedeMBP:bin sunjose$ pip3 install --upgrade pip setuptools
You are using pip version 7.1.0, however version 7.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting pip
Downloading pip-7.1.2-py2.py3-none-any.whl (1.1MB)
100% |████████████████████████████████| 1.1MB 305kB/s
Collecting setuptools
Downloading setuptools-18.3.2-py2.py3-none-any.whl (462kB)
100% |████████████████████████████████| 462kB 787kB/s
Installing collected packages: pip, setuptools
Found existing installation: pip 7.1.0
Uninstalling pip-7.1.0:
Successfully uninstalled pip-7.1.0
Found existing installation: setuptools 18.0.1
Uninstalling setuptools-18.0.1:
Successfully uninstalled setuptools-18.0.1
Successfully installed pip-7.1.2 setuptools-18.3.2


 Related Posts with Thumbnails 

0 意見 :

張貼留言