我在尝试让 virtualenv 在 Debian 12 上运行时遇到了一些问题,很难弄清楚到底是什么问题。我已经运行过了,apt update
而且apt upgrade
这是几天前刚刚在网络上安装的 Debian。
$ python3 -m venv code_execution_env
The virtual environment was not created successfully because ensurepip is not
available. On Debian/Ubuntu systems, you need to install the python3-venv
package using the following command.
apt install python3.11-venv
You may need to use sudo with that command. After installing the python3-venv
package, recreate your virtual environment.
Failing command: /home/chris/projects/claude-engineer/code_execution_env/bin/python3
$ sudo apt install -y python3.11-venv
Reading package lists... Done
Building dependency tree... Done
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.11-venv : Depends: python3.11 (= 3.11.2-6+deb12u2) but 3.11.2-6+deb12u3 is to be installed
E: Unable to correct problems, you have held broken packages.
我也尝试过python3-venv
,python3.11-full
但没有成功:
$ sudo apt-get install python3.11-full
[sudo] password for chris:
Reading package lists... Done
Building dependency tree... Done
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.11-full : Depends: python3.11 (= 3.11.2-6+deb12u2) but 3.11.2-6+deb12u3 is to be installed
Depends: python3.11-venv (= 3.11.2-6+deb12u2) but it is not going to be installed
Recommends: python3.11-doc but it is not going to be installed
Recommends: python3.11-examples but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
apt-缓存策略:
$ apt-cache policy python3.11 python3.11-venv
python3.11:
Installed: 3.11.2-6+deb12u3
Candidate: 3.11.2-6+deb12u3
Version table:
*** 3.11.2-6+deb12u3 100
100 /var/lib/dpkg/status
3.11.2-6+deb12u2 500
500 http://deb.debian.org/debian bookworm/main amd64 Packages
python3.11-venv:
Installed: (none)
Candidate: 3.11.2-6+deb12u2
Version table:
3.11.2-6+deb12u2 500
500 http://deb.debian.org/debian bookworm/main amd64 Packages
尝试过apt --fix-broken install
:
$ sudo apt --fix-broken install
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded
任何指示都会有帮助,很难知道这是否只是一些 python 打包问题或者也许我需要进一步关注确切的错误python3.11-venv : Depends: python3.11 (= 3.11.2-6+deb12u2) but 3.11.2-6+deb12u3 is to be installed
。
https://tracker.debian.org/pkg/python3.11还指出了一些相关内容:
软件包已消失 此软件包不在任何开发存储库中。这可能意味着该软件包已被删除(或已重命名)。因此,此处的信息并不重要...除非有人接管并重新引入它,否则该软件包将会消失。
根据输出
apt policy
,您的 中缺少安全 reposources.list
。按照Debian wiki 上的示例进行编辑,添加
sources.list
以下行:然后运行:
软件包:python3.11-venv (3.11.2-6+deb12u3) [安全]