简体   繁体   English

如何在 linux ubuntu 终端上安装 python3.9?

[英]How to install python3.9 on linux ubuntu terminal?

i Tried apt install python 3.9 and it reply我试过 apt install python 3.9 并回复

Building dependency tree
Reading state information... Done
E: Unable to locate package python3.9
E: Couldn't find any package by glob 'python3.9'
E: Couldn't find any package by regex 'python3.9'

If you are on Ubuntu 19.04 eoan (or any other version unsupported by the deadsnakes ppa ), you will not be able to install using the deadsnakes ppa.如果您使用的是 Ubuntu 19.04 eoan(或deadsnakes ppa不支持的任何其他版本),您将无法使用 deadsnakes ppa 进行安装。

What you can do instead, is get the source from Python's official website , and install it manually, as described here .你可以做什么,而不是,就是让从Python的官方网站,并手动安装,如所描述这里

To do so, first download the tarball and extract it:为此,首先下载 tarball 并将其解压缩:

wget https://www.python.org/ftp/python/3.9.0/Python-3.9.0.tar.xz
tar -xf Python-3.9.0.tar.xz

Then cd to the extracted directory:然后cd到解压目录:

cd Python-3.9.0

Now configure the script:现在配置脚本:

./configure

Now, to install Python3.9 alongside your current Python installation (if any), use:现在,要在当前的 Python 安装(如果有)旁边安装 Python3.9,请使用:

sudo make altinstall

Lastly, you can verify your installation using最后,您可以使用验证您的安装

python3.9 --version

You are getting that error because you first need to update the package list and the prerequisites.您收到该错误是因为您首先需要更新软件包列表和先决条件。

sudo apt update
sudo apt install software-properties-common

Then, add the repo ppa:deadsnakes/ppa to your sources list (where you will download python from)然后,将 repo ppa:deadsnakes/ppa 添加到您的源列表(您将从中下载 python)

sudo add-apt-repository ppa:deadsnakes/ppa

Make sure to press enter when prompted.确保在出现提示时按 Enter。

Lastly, install the version of your choice最后,安装您选择的版本

sudo apt install python3.9

Make sure to read this:请务必阅读以下内容:

Disclaimer: there's no guarantee of timely updates in case of security problems or other issues.免责声明:不保证在出现安全问题或其他问题时及时更新。 If you want to use them in a security-or-otherwise-critical environment (say, on a production server), you do so at your own risk.如果您想在安全或其他关键环境(例如,在生产服务器上)中使用它们,您需要自担风险。

PPA DeadsnakePPA死蛇

i Tried apt install python 3.9 and it reply我试过apt安装python 3.9并回复

Building dependency tree
Reading state information... Done
E: Unable to locate package python3.9
E: Couldn't find any package by glob 'python3.9'
E: Couldn't find any package by regex 'python3.9'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM