Когда я пытаюсь установить Python 3.8, терминал говорит, что готово, но когда я запускаю python --version
, он говорит Python 3.7?
(base) user@admin:~$ sudo apt-get install python3.8
Reading package lists... Done
Building dependency tree
Reading state information... Done
python3.8 is already the newest version (3.8.2-1ubuntu1.2).
The following packages were automatically installed and are no longer required:
libllvm9 libllvm9:i386
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 38 not upgraded.
(base) user@admin:~$ python --version
Python 3.7.6
As per the instructions on How to Install Python 3.8 on Ubuntu, Debian and LinuxMint – TecAdmin, try the following:
Install [and or update] the following packages; build-essential, checkinstall, libreadline-gplv2-dev, libncursesw5-dev, libssl-dev, libsqlite3-dev, tk-dev, libgdbm-dev, libc6-dev, libbz2-dev, libffi-dev, zlib1g-dev.
sudo apt install build-essential checkinstall
sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libffi-dev zlib1g-dev
Thereafter, change directory (cd
) to your opt
folder [or any convenient folder] and download the python source code from python's server:
cd /opt/
sudo wget https://www.python.org/ftp/python/3.8.3/Python-3.8.3.tgz
sudo tar xzf Python-3.8.3.tgz
cd
) the Python Folder [created after the extraction]cd Python-3.8.3
sudo ./configure --enable-optimizations
then
sudo make altinstall
Once the compilation is completed, you can confirm that Python 3.8 has been installed successfully with:
python3.8 -V
You should see the response Python-3.8.3
.
However, to precisely answer your question, python 3.8 isn't available via ubuntu official repos. You would have to add a PPA to get python 3.8 using sudo apt install [python3.x.x]
.
The process is described on How to Install Python 3.8 on Ubuntu 18.04 | Linuxize
Hope this helps and I hope I answered your question adequately.
It looks like Python 3.8 is already installed but not set as default. Python 3.7.6 is set as default.
Update default Python3 version by below command.
sudo update-alternatives --config python3
Choose Python 3.8 option and check Python version again.