UPDATED 2020 August: MacOs Cataline
Install homebrew
https://docs.brew.sh/Installation
mkdir homebrew && curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C homebrew
Add the path:
sudo nano ~/.bash_profile
Add this line:
export PATH="$HOME/homebrew/bin:$PATH"
Install python3:
brew install python
This python (v3) install pip3, in order to use only 'pip' , add an alias:
sudo nano ~/.bash_profile
Add this line:
alias pip=pip3
UPDATED 2019 October: MacOs Mojave
MacOS comes with python2
, but not with pip
. Anyway, it's better to manage it with homebrew, you must install it before:
https://docs.brew.sh/Installation
Install python2:
brew install python
WARNING: for a modern macOS (2019) this can install python3
, and for python2
you really need to do: brew install python@2
Install python3:
brew install python3
UPDATE: Python 3
If you install python3
, pip will be installed automatically.
brew install python3
NEW 2019: now to use pip version 3, use pip3
, or you can execute: python3
, to use version 3. When you install packages with pip3 they will be separated from python2
.
OLD: You need only to upgrade pip, but before that you need create a virtual environment to work with Python 3. You can use a project folder or any folder:
python3 -m venv venv
source venv/bin/activate
pip install --upgrade pip
Check the versions:
pip -V
python --version
NEW 2019:
pip3 -V
python3 --version
To deactivate the environment:
$ deactivate