728x90
반응형
Hello. This is codingwalks.
When using the source code published on Github, there are cases where the installation file of requirement.txt is not executed normally or not depending on the Python version. Therefore, in such cases, I will organize how to upgrade the Python version and change the default version in Ubuntu. The default version may be different depending on the Ubuntu version, and it was written based on Ubuntu 20.04.
Ubuntu 20.04 provides Python 3.8 by default, and we will upgrade it to 3.10.
1. Add and update the repository
- Since the Python 3.10 repository cannot be used in Ubuntu 20.04, you need to add the repository.
- Execute the command below to add the repository and proceed with the update.
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt update
sudo apt-list | grep python 3.10
2. Install Python 3.10
sudo apt install -y python3.10
3. Add Python version and change version
- Register the existing version 3.8 and the new version 3.10 in update-alternatives and specify the index.
- You can check the current version and change it using "update-alternatives --config".
# Change version
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 2
# Check and change version changes
sudo update-alternatives --config python3
# Check version
python3 -V
※ When not found occurs when calling Python
# Run from terminal
vi ~/.bashrc
# Add the following
alias python=python3
# Reflect changes in terminal
source ~/.bashrc
If you found this post useful, please like and subscribe below. ^^
728x90
반응형
'Programming > Python' 카테고리의 다른 글
Python Matplotlib Data Visualization - How to Use the imshow Function (0) | 2024.10.23 |
---|---|
Python Matplotlib Data Visualization - Drawing Basic Graphs (0) | 2024.10.23 |
PyCharm Installation Guide (feat. Anaconda Interpreter) (0) | 2024.10.23 |
Anaconda Installation Guide (feat. JupyterLab) (0) | 2024.10.23 |
Python venv creation error (returned non-zero exit status 1.) (0) | 2024.10.23 |