最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

【已解决】Ubuntu中apt安装python3.7报错:Ubuntu E Unable to locate package python3.7

Ubuntu crifan 802浏览 0评论
折腾:
【未解决】Ubuntu中升级Python 3.5到最新版的Python 3.7
期间,Ubuntu中尝试去安装Python3.7:
sudo apt-get install python3.7
结果报错:
Ubuntu E: Unable to locate package python3.7
“Unable to locate package” while trying to install packages with APT – Ask Ubuntu
apt – “Unable to locate package python-pip” When trying to install from fresh 18.04 install – Ask Ubuntu
Python3.5-dev in Ubuntu 18.04 – Ask Ubuntu
参考之前的:
Installing the Latest Python 3.7 on Ubuntu 16.04 / 18.04 | Website for Students
说的:
sudo apt update
sudo apt install software-properties-common

sudo add-apt-repository ppa:deadsnakes/ppa

sudo apt update
sudo apt install python3.7
去试试:
sudo add-apt-repository ppa:deadsnakes/ppa
详细log:
# sudo add-apt-repository ppa:deadsnakes/ppa

 This PPA contains more recent Python versions packaged for Ubuntu.

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.

Update Note
===========
Please use this repository instead of ppa:fkrull/deadsnakes.

Reporting Issues
================

Issues can be reported in the master issue tracker at:

Supported Ubuntu and Python Versions
====================================

- Ubuntu 16.04 (xenial) Python 2.3 - Python 2.6, Python 3.1 - Python3.4, Python 3.6 - Python3.8
- Ubuntu 18.04 (bionic) Python2.3 - Python 2.6, Python 3.1 - Python 3.5, Python3.7 - Python3.8
- Note: Python2.7 (both), Python 3.5 (xenial), Python 3.6 (bionic) are not provided by deadsnakes as upstream ubuntu provides those packages.

The packages may also work on other versions of Ubuntu or Debian, but that is not tested or supported.

Third-Party Python Modules
==========================

Python modules in the official Ubuntu repositories are packaged to work with the Python interpreters from the official repositories. Accordingly, they generally won't work with the Python interpreters from this PPA. As an exception, pure-Python modules for Python 3 will work, but any compiled extension modules won't.

To install 3rd-party Python modules, you should use the common Python packaging tools.  For an introduction into the Python packaging ecosystem and its tools, refer to the Python Packaging User Guide:

Sources
=======
The package sources are available at:
 More info: 
https://launchpad.net/~deadsnakes/+archive/ubuntu/ppa
Press [ENTER] to continue or ctrl-c to cancel adding it
gpg: keyring `/tmp/tmp31o_ak4_/secring.gpg' created
gpg: keyring `/tmp/tmp31o_ak4_/pubring.gpg' created
gpg: requesting key 6A755776 from hkp server 
keyserver.ubuntu.com
gpg: /tmp/tmp31o_ak4_/trustdb.gpg: trustdb created
gpg: key 6A755776: public key "Launchpad PPA for deadsnakes" imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
OK
然后再去试试:
sudo apt-get update
sudo apt-get install python3.7
详细log
# sudo apt-get update
Hit:1 http://mirrors.tencentyun.com/ubuntu xenial InRelease
Hit:2 http://mirrors.tencentyun.com/ubuntu xenial-security InRelease
Hit:3 http://mirrors.tencentyun.com/ubuntu xenial-updates InRelease
Get:4 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu xenial InRelease [18.0 kB]              
Hit:5 http://nginx.org/packages/ubuntu xenial InRelease                                      
Hit:6 http://ppa.launchpad.net/ondrej/php/ubuntu xenial InRelease             
Hit:7 http://ppa.launchpad.net/webupd8team/y-ppa-manager/ubuntu xenial InRelease
Get:8 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu xenial/main amd64 Packages [27.9 kB]
Get:9 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu xenial/main i386 Packages [27.9 kB]                                                                                 

Fetched 80.4 kB in 7s (11.5 kB/s)                                                                                                                                        
Reading package lists... Done
就可以了:
# sudo apt-get install python3.7
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  libpython3.7-minimal libpython3.7-stdlib python3.7-distutils python3.7-lib2to3 python3.7-minimal
Suggested packages:
  python3.7-venv python3.7-doc binfmt-support
The following NEW packages will be installed:
  libpython3.7-minimal libpython3.7-stdlib python3.7 python3.7-distutils python3.7-lib2to3 python3.7-minimal
0 upgraded, 6 newly installed, 0 to remove and 432 not upgraded.
2 not fully installed or removed.
Need to get 4,814 kB of archives.
After this operation, 24.2 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 
http://ppa.launchpad.net/deadsnakes/ppa/ubuntu
 xenial/main amd64 libpython3.7-minimal amd64 3.7.3-1+xenial1 [595 kB]
6% [1 libpython3.7-minimal 344 kB/595 kB 58%]      
【总结】
此处Ubuntu中
sudo apt-get install python3.7
会报错:
Ubuntu E: Unable to locate package python3.7
原因:apt默认的源中没有Python3.7
解决办法:
加上有Python 3.7的源:
sudo add-apt-repository ppa:deadsnakes/ppa
再去更新一下:
sudo apt-get update
再去安装:
sudo apt-get install python3.7
即可。

转载请注明:在路上 » 【已解决】Ubuntu中apt安装python3.7报错:Ubuntu E Unable to locate package python3.7

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
88 queries in 0.142 seconds, using 20.83MB memory