Apple’s Mac OS comes with python 2.7 installed by default. Perhaps you may want to use python 3.x.x on your machine and also use pip for package management with python 3.x.x.
The easiest way to achieve this is by:
NOTE: This tutorial does not use Virtual Environments like virtualenv
or pyenv
to manage various python
versions
1. Installing python3
- Follow this link and download the latest
python3
OS X
package - Run the package and follow the steps to install
python3
on your computer. - Once the installation is done, on your
Terminal
, run
python3 --version
This will print out the version of python installed on your system. The output should be similar to:
Python 3.6.1
You may verify the installation directory of python
by runningthe following line on the Terminal
.
which python3
The prompt should print the install path for python3
. An example output is:
/Library/Frameworks/Python.framework/Versions/3.6/bin/python3
2. Install pip3
:
- Securely download the
get-pip.py
file from this link - From the directory where the file was downloaded to, run the following command in the
Terminal
python3 get-pip.py
- Once the installation completes you should see the prompt print message similar to this
- Verify the installation of
pip3
by running the following on theTerminal
which pip3
This should return the install location of pip3
.
- To install
python3
packages usingpip3
, run
pip3 packageName
Remember to replace packageName
with the appropriate package name for your case.
Happy Pythoning!