首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >无法在Ubuntu 20.04中安装python3-venv,一些损坏的软件包

无法在Ubuntu 20.04中安装python3-venv,一些损坏的软件包
EN

Stack Overflow用户
提问于 2022-10-27 08:22:40
回答 1查看 25关注 0票数 0

这可能是很长的时间,但请忍耐到最后。

当我试图安装python3-venv时,我遵循了这篇文章

代码语言:javascript
运行
复制
sudo apt install build-essential libssl-dev libffi-dev python3-dev

它抛出了以下错误:

代码语言:javascript
运行
复制
libffi-dev python3-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libffi-dev is already the newest version (3.3-4).
build-essential is already the newest version (12.8ubuntu1.1).
libssl-dev is already the newest version (1.1.1f-1ubuntu2.16).
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 python3-dev : Depends: libpython3-dev (= 3.8.2-0ubuntu2) but it is not going to be installed
               Depends: python3.8-dev (>= 3.8.2-1~) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

因此,我没有使用python3-dev,而是只尝试了python3,然后它运行了。

之后,我运行了以下命令:

代码语言:javascript
运行
复制
sudo apt install -y python3-venv

然后它给了我这个:

代码语言:javascript
运行
复制
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 python3-venv : Depends: python3.8-venv (>= 3.8.2-1~) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

所以我想也许我需要安装python3.8-venv,所以我安装了:

代码语言:javascript
运行
复制
sudo apt install -y python3.8-venv

它给了我一个错误:

代码语言:javascript
运行
复制
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 python3.8-venv : Depends: python3.8 (= 3.8.10-0ubuntu1~20.04.5) but 3.8.13-1+bionic2 is to be installed
E: Unable to correct problems, you have held broken packages.

然后,我试着:

代码语言:javascript
运行
复制
sudo apt install -y python3.8

很好然后给了我这个

代码语言:javascript
运行
复制
Reading package lists... Done
Building dependency tree       
Reading state information... Done
python3.8 is already the newest version (3.8.13-1+bionic2).
0 upgraded, 0 newly installed, 0 to remove and 6 not upgraded.

我不知道该做什么,我的虚拟env没有工作,我在某个地方读到它已经预先安装,所以我也尝试直接创建一个虚拟env

代码语言:javascript
运行
复制
python3 -m venv myEnv

这又给了我这个:

代码语言:javascript
运行
复制
Error: Command '['/home/yash/Desktop/DashMed/myEnv/bin/python3', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1.

谷歌上说安装python3 3-venv我已经失败了

所以我被困在这个循环里

请帮帮忙

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-10-27 10:29:45

造成这些问题的主要原因是python3.8的版本。

我有3.8.13-1+bionic2版本,但我们需要3.8.10-0ubuntu1~20.04.5

我认为这通常发生在您使用内置软件和更新从Ubuntu18.04LTS升级到Ubuntu20.04LTS时。

所以我找到了这个命令,它回滚了所有的版本,一切都很好。

代码语言:javascript
运行
复制
sudo apt install libpython3.8:amd64=3.8.2-1ubuntu1 libpython3.8-dev:amd64=3.8.2-1ubuntu1 libpython3.8-minimal:amd64=3.8.2-1ubuntu1 libpython3.8-stdlib:amd64=3.8.2-1ubuntu1 python3.8=3.8.2-1ubuntu1 python3.8-minimal=3.8.2-1ubuntu1

在此之后,所有其他命令都在我的系统上完美地运行。

我找到了这个回滚命令这里

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/74218920

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档