SourceURL:file://Document1
Method 1: Build python 3.11 from source.
Note: You can choose whichever python version you want, just find the correct fpt link from https://www.python.org/ftp/python/
1. Update your system:
sudo apt-get update
2. Install the required dependencies to be able to build Python 3.11 from the source:
sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev libsqlite3-dev wget libbz2-dev tk-dev
3. Make a directory for python 3.11:
mkdir python311
4. Navigate to the directory:
cd python311
5. Then download Python 3.11 from the official Python release page. While on this page, download the Python 3.11 Gzippeed tarball. Alternatively, get the download link and pull it with Wget as shown:
wget https://www.python.org/ftp/python/3.11.4/Python-3.11.4.tgz
6. With the tarball downloaded, extract it as below:
tar -xf Python-3.11.*.tgz
7. Navigate into the extracted directory and run the configure command to check if the required dependencies are available.
cd Python-3.11.*/
sudo ./configure --enable-optimizations
8. When the check is complete, build Python 3.11 from the source as below:
make -j 2
9. When make is complete, proceed and install Python 3.11:
sudo make altinstall
Note: The altinstall flag is used to maintain the default Python binary path in /usr/bin/python.
10. Verify your installation:
python3.11 --version
It should output: Python 3.11.04
$ python3.11 --version
Python 3.11.4
Installation successful.
Method 2: Miniforge conda
1. Open terminal
2. Download the miniforge conda installer file for python 3.10 -
wget https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-aarch64.sh
3. Navigate to the downloaded directory and look for the miniforge installation file you just downloaded.
4. Install the miniforge conda with: sudo bash Miniforge3-Linux-aarch64.sh
5. Press Enter
6. Accept license: Accept the license agreement with >>> yes
7. Select installation path. When asked, select the default install location or any location you want. For example - >>> /root/miniforge3
8. Initialize miniforge conda by adding it in your bash file to select conda python as your default python environment. Select “yes” to initialize or “no” to reject.
-> Do you wish the installer to initialize Miniforge3 >>> yes
9. Source the bashrc to reload the environment variables: source ~/.bashrc
You will see conda has been initialized in your bash file.
11. Check whether miniforge conda is working correctly, type: conda
12. Activate conda base if it is not activated already: conda activate
You shall see, now you are inside conda base environment.
13. Check if conda python is being used: which python
14. Check python version: python --version
15. Deactivate conda base to get back to your default python environment: conda deactivate
Installation successful.