简体   繁体   English

为什么我不能在 Ubuntu16.04 上安装 python3.6-dev

[英]Why can't I install python3.6-dev on Ubuntu16.04

I am trying to install Python 3.6-dev with this command:我正在尝试使用以下命令安装Python 3.6-dev

sudo apt-get install python3.6-dev

but I'm getting this error:但我收到此错误:

E: Unable to locate package python3.6-dev
E: Couldn't find any package by glob 'python3.6-dev'
E: Couldn't find any package by regex 'python3.6-dev'

Can anyone help?任何人都可以帮忙吗? Why am I getting this error and what is the correct way to install the package?为什么我会收到此错误以及安装软件包的正确方法是什么?

sudo add-apt-repository ppa:deadsnakes/ppa \
&& sudo apt update \
&& sudo apt install python3.6

Edit: The following PPA has been disabled, see discussion here and the new PPA here .编辑:下面的PPA已被禁用,见讨论这里和新的PPA这里 So use the PPA mentioned above instead.因此,请改用上面提到的 PPA。

Original answer:原答案:

As mentioned by omajid the package is not availible in 16.04.正如 omajid 所提到的,该软件包在 16.04 中不可用。 But if you need it in 16.04 you can get it by adding for example the personal package repository of Felix Krull:但是如果你在 16.04 需要它,你可以通过添加例如 Felix Krull 的个人包存储库来获取它:

sudo add-apt-repository ppa:fkrull/deadsnakes

This ppa worked like a charm on ubuntu 16.04.这个 ppa 在 ubuntu 16.04 上就像一个魅力。 Posting here for others.在这里发布给其他人。

sudo apt-get install software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa 
sudo apt-get update
sudo apt-get install python3.6

For those who tried to install python-3.6 and got same error as that one above.对于那些尝试安装 python-3.6 并遇到与上面相同的错误的人。 This can help you as well us it helped me fix out the pb.这对我们也有帮助,它帮助我解决了 pb。

  1. Open terminal then run command to add the PPA:打开终端,然后运行命令添加 PPA:

    sudo add-apt-repository ppa:jonathonf/python-3.6

  2. Then check updates and install Python 3.6 via commands:然后通过命令检查更新并安装 Python 3.6:

    sudo apt-get update

    sudo apt-get install python3.6

Now to make sure you had install successufly just run python3.6-v or python3.6现在确保你已经安装成功,只需运行python3.6-vpython3.6

For more details check here "How to Install Python 3.6.1 in Ubuntu 16.04 LTS"有关更多详细信息,请查看此处“如何在 Ubuntu 16.04 LTS 中安装 Python 3.6.1”

Note: Linux 16.04 use python v 2.7 as default one if u needa use python 3.6 in your project just set python-3.6 as default version for this project.注意:Linux 16.04 使用 python v 2.7 作为默认版本,如果您需要在项目中使用 python 3.6,只需将 python-3.6 设置为此项目的默认版本。 It's better then use sudo update-alternatives ... command then your terminal will vanish :(.最好使用sudo update-alternatives ...命令,然后您的终端将消失:(。

The package is too new.包太新了。 It's not available in the older 16.04 release.它在较旧的 16.04 版本中不可用。 It's available in the newer Ubuntu 16.10 .它在较新的Ubuntu 16.10 中可用。

i tried lot of things and it costs me hell lot of time.我尝试了很多东西,这花费了我很多时间。

this ppa:jonathonf Didnt worked for me.这个 ppa:jonathonf 没有为我工作。

 ppa:deadsnakes working fine for now.

what worked is below commands:有效的是以下命令:

open terminal then然后打开终端

sudo apt-get update sudo apt-get 更新

sudo apt-get upgrade sudo apt-get 升级

sudo apt-get install software-properties-common sudo apt-get install software-properties-common

sudo add-apt-repository ppa:deadsnakes/ppa sudo add-apt-repository ppa:deadsnakes/ppa

sudo apt-get update sudo apt-get 更新

sudo apt-get install python3.6须藤 apt-get 安装 python3.6

sudo add-apt-repository ppa:deadsnakes/ppa

猜猜他们更改了 repo 的名称。

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

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