Python 3.10 on ubuntu
Following the Python Official website download location from where you can download the python
- Choosing the Python Package :
To install Python 3.10.0 on Ubuntu, you should download the source code file with the .tar.xz extension. In this case, the file you should choose is:
Python-3.10.0.tar.xz - It's the source code archive for Python 3.10.0.
You can download it and then follow the typical steps to compile and install Python from source on Ubuntu. Here's a general guide for building and installing Python from source:
Download Python source code:
wget https://www.python.org/ftp/python/3.10.0/Python-3.10.0.tar.xzExtract the source code:
tar -xf Python-3.10.0.tar.xzNavigate to the source code directory:
cd Python-3.10.0
Build and Install Python 3.10:
Navigate to the Python source directory and run the following commands to build and install Python:
cd Python-3.10.0 ./configure --enable-optimizations make -j$(nproc) sudo make altinstallThe
--enable-optimizationsflag is recommended to enable additional optimizations during the build process.Verify Python Installation:
You can verify that Python 3.10 is installed correctly by running:
python3.10 --versionThis should display the Python version as "Python 3.10.0."
If they are multiple Python installations, How do set the installed version to the default version
First, ensure you have Python 3.10 installed on your system.
Open a terminal and run the following command to configure Python alternatives:
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.10 1
This command creates a symbolic link from /usr/bin/python to /usr/bin/python3.10 and assigns it a priority 1.
- Now, you can select the Python version you want to use as the default. Run:
sudo update-alternatives --config python
This command will display a list of installed Python versions, and you can choose the one you want to set as the default by entering the selection number.
After doing this, when you run python --version, it will show the version of Python 3.10. You can use the same approach to switch between different Python versions easily.