Python 3.11.0 Final was officially released today by the Python Foundation (see link to announcement below). As usual I downloaded the sources and built it. Rather than send you across multiple prior posts, here’s basically what I did, again for this release.
Ubuntu 22.10 comes with Python 3.10.7, the latest official release. But I always want to work with the absolute latest release, on the day it comes out.
Install Build Prerequisites
You need to install the following packages in order to build every module in Python.
sudo apt install zlib1g-dev \ libncurses5-dev \ libgdbm-dev \ libnss3-dev \ libssl-dev \ libreadline-dev \ libffi-dev \ libsqlite3-dev \ libbz2-dev \ tk \ tk-dev \ liblzma-dev \ libgdbm-compat-dev
Build And Install Python 3.11.0
- Download the latest Python version from https://www.python.org/downloads/
- Untar the file into a work folder of your choice
- Make a build directory at the same level as the untarred source directory.
- From within the build directory execute the configure script. In this example we’re building Python 3.11.0.
- Within the build directory run make.
- Install into the alternate location for this version of Python:
sudo -H make altinstall
- Check for the alternate location with
which python3.11. It should return
Create A Virtual Work Environment
- In your home directory create a work folder. On my system I named it ‘VPython’, but you can call it whatever you want.
- Change directory into it, then create a Python virtual environment using, as an example,
python3.11 -m venv 311.
- There is a bin directory in the virtual directory you created, which in this example was 311. Start the environment with
I created an alias so that typing
311 in any shell starts the environment. The alias should source the full path and the script in the virtual environment’s bin directory. When active, typing
deactivate drops you back to a regular shell environment. See the following screen capture.
And that’s it. Easy-peasy as they say.
You must be logged in to post a comment.