How to Install Multiple Python Versions on Unihiker in the Simplest Way? For example , Python 3.10.
I'm currently using Unihiker and I'm trying to install multiple Python versions, for example Python 3.10. I'm looking for the simplest and most straightforward method to achieve this.
Could anyone provide a step-by-step guide on how to install and manage multiple Python versions on Unihiker?
Any help would be greatly appreciated.
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.
mansuI have successfully tested this method, but the compilation time in the middle is quite long. Thank you very much for your answer.
Also, since this is a brand new Python installation, some commonly used pip libraries like pinpong, unihiker, siot, and numpy are missing. You can run the following command to install them: pip3.11 install pinpong numpy unihiker siot
I have made several different Python packages and put them on Github for easy use. Link: https://github.com/liliang9693/UNIHIKER-python-makefiles.
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.
mansuHow to change python version in unihiker jupyter notebook?