I went to Python's main website and I downloaded the correct Python 3.7.0 files for my system, and I just set up and updated pip, and imported certifi, but when I checked what version of Python my system was running, it said Python 2.7. How do I get my system to actually use the new version of Python?
Thanks!
Default meaning of Python on the command-line may not be clear. Python is usually an alias for python2.7 (but it can sometimes be an alias for older versions like python2.6 or python2.5). To find out exactly which version of Python you're using, you can use the --version flag.
$ python --version
Python 3 is usually available under the name of python3.
$ python3 --version
To use version 3.7:
$ python3.7
Your system, i.e. macOS will not use 3.7, furthermore (
Documentation >>> Python Setup and Usage >>> Using Python on Macintosh):
Quote:The Apple-provided build of Python is installed in /System/Library/Frameworks/Python.framework and /usr/bin/python, respectively. You should never modify or delete these, as they are Apple-controlled and are used by Apple- or third-party software. Remember that if you choose to install a newer Python version from python.org, you will have two different but functional Python installations on your computer, so it will be important that your paths and usages are consistent with what you want to do.
Doing it Right Mac
Alternative
pyenv(Simple Python Version Management) also work on Mac.
Example how it look on Linux:
# Update pyenv
mint@mint ~ $ pyenv update
# Look at what's available
mint@mint ~ $ pyenv install --list
Available versions:
....
3.6.6
3.6.6rc1
3.7.0
3.7-dev
3.8-dev
....
# Update needed
sudo apt-get update
sudo apt-get install libffi-dev
# install
mint@mint ~ $ pyenv install 3.7.0
Installing Python-3.7.0...
Installed Python-3.7.0 to /home/mint/.pyenv/versions/3.7.0
# Set python and pip to point to 3.7
mint@mint ~ $ pyenv global 3.7.0
mint@mint ~ $ python -V
Python 3.7.0
mint@mint ~ $ pip -V
pip 10.0.1 from /home/mint/.pyenv/versions/3.7.0/lib/python3.7/site-packages/pip (python 3.7)
mint@mint ~ $
# Finish
So now do
python
and
pip
always point to what you set
global
in this case 3.7.