Install Python 3.8.1 on Mac using pyenv
In this tutorial, I will show you how to install Python 3.8.1 on Mac using pyenv.
Python 3.8.1 is the newest major release of the Python programming language, and it contains many new features and optimizations.
Read Also: How to install Python 3.7.0 on Mac
1. Install Pyenv using brew
In the first step, we will install pyenv using brew.
~ brew install pyenv
or
~ brew upgrade pyenv #If pyenv is already installed
and add a pyenv path into your profile. I am zsh so I will add the PATH into .zshrc. If you are using bash add the following to .bashrc or .profile or .bash_profile.
~ echo 'export PATH="$(pyenv root)/shims:$PATH"' >> ~/.zshrc
~ source ~/.zshrc
Consider reading: How to install Python 3.7 on Raspberry PI
2. Install Python 3.8.1 on Mac
Now we will just use pyenv to install python. pyenv makes it easy to install and switch Python versions.
~ pyenv install --list | grep 3.8.1
3.8.1
~ pyenv install 3.8.1
python-build: use openssl@1.1 from homebrew
python-build: use readline from homebrew
Downloading Python-3.8.1.tar.xz…
-> https://www.python.org/ftp/python/3.8.1/Python-3.8.1.tar.xz
Installing Python-3.8.1…
python-build: use readline from homebrew
python-build: use zlib from xcode sdk
Installed Python-3.8.1 to /Users/chetan/.pyenv/versions/3.8.1
and it installed successfully.
3. Check the list of installed Python
We can manage and switch Python versions using pyenv. For complete tutorial follow this link.
~ pyenv versions
system
* 3.8.0 (set by /Users/chetan/.pyenv/version)
3.8.1
4. Set the default version
Now we will set the default python version to 3.8.1
~ pyenv global 3.8.1
5. Check the Python Version
Now after installation lets check the python version with the following command.
~ python3 -V
Python 3.8.1
Python 3.8.1 is installed successfully.
Please let me know how you like the tutorial.
If you like this tutorial please consider buying me a coffee!
Read Also: How to remove rvm on Mac
Source: pyenv