如何在Ubuntu 16上安装Python3.7?

问题描述 投票:0回答:1

我尝试了这种方法但是得到了:

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?

ubuntu-16.04 python-3.7
1个回答
0
投票

只需执行以下步骤

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
© www.soinside.com 2019 - 2024. All rights reserved.