提问人:personal_cloud 提问时间:8/30/2023 更新时间:8/30/2023 访问量:392
如何在 Ubuntu 3.7 上安装 Python16?
How do I install Python3.7 on Ubuntu 16?
问:
我尝试了这种方法,但得到了:
add-apt-repository ppa:deadsnakes/ppa
Error processing line 1 of /usr/local/lib/python3.5/dist-packages/distutils-precedence.pth:
Traceback (most recent call last):
File "/usr/lib/python3.5/site.py", line 173, in addpackage
exec(line)
File "<string>", line 1, in <module>
File "/usr/local/lib/python3.5/dist-packages/_distutils_hack/__init__.py", line 194
f'spec_for_{name}',
^
SyntaxError: invalid syntax
Remainder of file ignored
Building dependency tree
Reading state information... Done
E: Unable to locate package python3.7
E: Couldn't find any package by glob 'python3.7'
E: Couldn't find any package by regex 'python3.7'
看起来某个包正在 Python3.5 中运行 Python3.6 脚本。这与问题有关吗?
如何安装 Python3.7?
答:
1赞
Muhammad Aasharib Nawshad
8/30/2023
#1
只需执行以下步骤
sudo apt update
sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev wget
wget https://www.python.org/ftp/python/3.7.4/Python-3.7.4.tgz
sudo tar xzf Python-3.7.4.tgz
cd Python-3.7.4
sudo ./configure
sudo make
sudo make install
评论
0赞
personal_cloud
8/30/2023
它有效!比使用任何不稳定的包管理器要容易得多......谢谢。
0赞
Muhammad Aasharib Nawshad
8/30/2023
伟大。。。别客气。。。不客气!
0赞
Codemaker2015
8/30/2023
#2
要使用 Deadsnakes PPA 在 Ubuntu 上安装 Python 3.7,请按照下列步骤操作:
如果您的系统上尚未安装,可以使用以下命令进行安装:
software-properties-common
sudo apt-get update sudo apt-get install software-properties-common
Deadsnakes PPA 提供了默认存储库中不可用的各种 Python 版本。您可以使用以下命令将其添加到系统中:
sudo add-apt-repository ppa:deadsnakes/ppa sudo apt-get update
现在添加了 Deadsnakes PPA,您可以继续安装 Python 3.7:
sudo apt-get install python3.7
若要确认 Python 3.7 已成功安装,请运行以下命令:
python3.7 -V
更多:https://www.osetc.com/en/how-to-install-the-latest-python-3-7-on-ubuntu-16-04-or-18-04.html
评论