这可能是很长的时间,但请忍耐到最后。
当我试图安装python3-venv时,我遵循了这篇文章。
sudo apt install build-essential libssl-dev libffi-dev python3-dev
它抛出了以下错误:
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
,然后它运行了。
之后,我运行了以下命令:
sudo apt install -y python3-venv
然后它给了我这个:
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
,所以我安装了:
sudo apt install -y python3.8-venv
它给了我一个错误:
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.
然后,我试着:
sudo apt install -y python3.8
很好然后给了我这个
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
python3 -m venv myEnv
这又给了我这个:
Error: Command '['/home/yash/Desktop/DashMed/myEnv/bin/python3', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1.
谷歌上说安装python3 3-venv我已经失败了
所以我被困在这个循环里
请帮帮忙
发布于 2022-10-27 10:29:45
造成这些问题的主要原因是python3.8的版本。
我有3.8.13-1+bionic2
版本,但我们需要3.8.10-0ubuntu1~20.04.5
我认为这通常发生在您使用内置软件和更新从Ubuntu18.04LTS升级到Ubuntu20.04LTS时。
所以我找到了这个命令,它回滚了所有的版本,一切都很好。
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
在此之后,所有其他命令都在我的系统上完美地运行。
我找到了这个回滚命令这里
https://stackoverflow.com/questions/74218920
复制相似问题