I encountered this issue as well, so I thought I should post an updated answer. Please note that this will only apply to a Mac-based setup (I haven't tried it with Windows or any flavor of Linux). The simplest way to get this working is to install Python via Brew. If you don't have brew installed, you will need to do that first. Once installed, do the following in at the terminal:
brew install python
This will install Python 3. After it's installed, run this:
ls -l /usr/local/bin/python*
You will see all of the links created by brew to its Python install. It will look something like this:
lrwxr-xr-x 1 username admin 36 Oct 1 13:35 /usr/local/bin/python3@ -> ../Cellar/python/3.7.4_1/bin/python3
lrwxr-xr-x 1 username admin 43 Oct 1 13:35 /usr/local/bin/python3-config@ -> ../Cellar/python/3.7.4_1/bin/python3-config
lrwxr-xr-x 1 username admin 38 Oct 1 13:35 /usr/local/bin/python3.7@ -> ../Cellar/python/3.7.4_1/bin/python3.7
lrwxr-xr-x 1 username admin 45 Oct 1 13:35 /usr/local/bin/python3.7-config@ -> ../Cellar/python/3.7.4_1/bin/python3.7-config
lrwxr-xr-x 1 username admin 39 Oct 1 13:35 /usr/local/bin/python3.7m@ -> ../Cellar/python/3.7.4_1/bin/python3.7m
lrwxr-xr-x 1 username admin 46 Oct 1 13:35 /usr/local/bin/python3.7m-config@ -> ../Cellar/python/3.7.4_1/bin/python3.7m-config
The first row in this example shows the python3
symlink. To set it as the default python
symlink run the following:
ln -s -f /usr/local/bin/python3 /usr/local/bin/python
Similarly you can set the pip symlink too
ln -s -f /usr/local/bin/pip3 /usr/local/bin/pip
You will have to reload your current terminal shell to use the new symlink in that shell. Run this command to reload your shell:
exec $SHELL -l
You're all set now. Now, you can do:
which python
and it should show:
/usr/local/bin/python
All newly opened shell sessions will (should) automatically use the new symlink. To test this, open a new terminal shell and run the following:
python --version
pyenv
. – Ennius