排查步骤如下
1. python3 -m venv venv
bash
he 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.8-venv
You may need to use sudo with that command. After installing the python3-venv
package, recreate your virtual environment.
Failing command: ['/mnt/d/myworkspace/workspace/bdd_demo/venv/bin/python3', '-Im', 'ensurepip', '--upgrade', '--default-pip']
2. apt install python3.8-venv
bash
E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?
3. sudo apt install python3.8-venv
bash
[sudo] password for admin:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
libsigsegv2 pastebinit python3-newt run-one
Use 'sudo apt autoremove' to remove them.
The following NEW packages will be installed:
python3.8-venv
0 upgraded, 1 newly installed, 0 to remove and 167 not upgraded.
Need to get 5452 B of archives.
After this operation, 27.6 kB of additional disk space will be used.
Ign:1 http://mirrors.aliyun.com/ubuntu focal-security/universe amd64 python3.8-venv amd64 3.8.10-0ubuntu1~20.04.11
Err:1 http://mirrors.aliyun.com/ubuntu focal-security/universe amd64 python3.8-venv amd64 3.8.10-0ubuntu1~20.04.11
404 Not Found [IP: 115.238.190.64 80]
E: Failed to fetch http://mirrors.aliyun.com/ubuntu/pool/universe/p/python3.8/python3.8-venv_3.8.10-0ubuntu1~20.04.11_amd64.deb 404 Not Found [IP: 115.238.190.64 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
4. sudo apt install python3.8-venv
bash
sudo apt update
5. sudo apt update
bash
Hit:1 http://mirrors.aliyun.com/ubuntu focal InRelease
Get:2 http://mirrors.aliyun.com/ubuntu focal-security InRelease [128 kB]
Get:3 http://mirrors.aliyun.com/ubuntu focal-updates InRelease [128 kB]
Get:4 http://mirrors.aliyun.com/ubuntu focal-proposed InRelease [277 kB]
Get:5 http://mirrors.aliyun.com/ubuntu focal-backports InRelease [128 kB]
Get:6 http://mirrors.aliyun.com/ubuntu focal-security/restricted Sources [55.3 kB]
Get:7 http://mirrors.aliyun.com/ubuntu focal-security/universe Sources [253 kB]
Get:8 http://mirrors.aliyun.com/ubuntu focal-security/multiverse Sources [17.1 kB]
Get:9 http://mirrors.aliyun.com/ubuntu focal-security/main Sources [331 kB]
Get:10 http://mirrors.aliyun.com/ubuntu focal-security/main amd64 Packages [3357 kB]
Get:11 http://mirrors.aliyun.com/ubuntu focal-security/main Translation-en [490 kB]
Get:12 http://mirrors.aliyun.com/ubuntu focal-security/main amd64 c-n-f Metadata [14.3 kB]
Get:13 http://mirrors.aliyun.com/ubuntu focal-security/restricted amd64 Packages [3343 kB]
Get:14 http://mirrors.aliyun.com/ubuntu focal-security/restricted Translation-en [468 kB]
Get:15 http://mirrors.aliyun.com/ubuntu focal-security/restricted amd64 c-n-f Metadata [548 B]
Get:16 http://mirrors.aliyun.com/ubuntu focal-security/universe amd64 Packages [1031 kB]
Get:17 http://mirrors.aliyun.com/ubuntu focal-security/universe Translation-en [218 kB]
Get:18 http://mirrors.aliyun.com/ubuntu focal-security/universe amd64 c-n-f Metadata [21.4 kB]
Get:19 http://mirrors.aliyun.com/ubuntu focal-security/multiverse amd64 Packages [24.8 kB]
Get:20 http://mirrors.aliyun.com/ubuntu focal-security/multiverse amd64 c-n-f Metadata [540 B]
Get:21 http://mirrors.aliyun.com/ubuntu focal-updates/main Sources [606 kB]
Get:22 http://mirrors.aliyun.com/ubuntu focal-updates/restricted Sources [56.5 kB]
Get:23 http://mirrors.aliyun.com/ubuntu focal-updates/universe Sources [411 kB]
Get:24 http://mirrors.aliyun.com/ubuntu focal-updates/multiverse Sources [30.0 kB]
Get:25 http://mirrors.aliyun.com/ubuntu focal-updates/main amd64 Packages [3735 kB]
Get:26 http://mirrors.aliyun.com/ubuntu focal-updates/main Translation-en [570 kB]
Get:27 http://mirrors.aliyun.com/ubuntu focal-updates/main amd64 c-n-f Metadata [17.8 kB]
Get:28 http://mirrors.aliyun.com/ubuntu focal-updates/restricted amd64 Packages [3493 kB]
Get:29 http://mirrors.aliyun.com/ubuntu focal-updates/restricted Translation-en [488 kB]
Get:30 http://mirrors.aliyun.com/ubuntu focal-updates/restricted amd64 c-n-f Metadata [548 B]
Get:31 http://mirrors.aliyun.com/ubuntu focal-updates/universe amd64 Packages [1253 kB]
Get:32 http://mirrors.aliyun.com/ubuntu focal-updates/universe Translation-en [300 kB]
Get:33 http://mirrors.aliyun.com/ubuntu focal-updates/universe amd64 c-n-f Metadata [28.3 kB]
Get:34 http://mirrors.aliyun.com/ubuntu focal-updates/multiverse amd64 Packages [27.9 kB]
Get:35 http://mirrors.aliyun.com/ubuntu focal-updates/multiverse Translation-en [7968 B]
Get:36 http://mirrors.aliyun.com/ubuntu focal-updates/multiverse amd64 c-n-f Metadata [612 B]
Get:37 http://mirrors.aliyun.com/ubuntu focal-proposed/restricted Sources [4932 B]
Get:38 http://mirrors.aliyun.com/ubuntu focal-proposed/multiverse Sources [1948 B]
Get:39 http://mirrors.aliyun.com/ubuntu focal-proposed/universe Sources [9904 B]
Get:40 http://mirrors.aliyun.com/ubuntu focal-proposed/main Sources [30.7 kB]
Get:41 http://mirrors.aliyun.com/ubuntu focal-proposed/main amd64 Packages [254 kB]
Get:42 http://mirrors.aliyun.com/ubuntu focal-proposed/main Translation-en [52.3 kB]
Get:43 http://mirrors.aliyun.com/ubuntu focal-proposed/main amd64 c-n-f Metadata [1436 B]
Get:44 http://mirrors.aliyun.com/ubuntu focal-proposed/restricted amd64 Packages [358 kB]
Get:45 http://mirrors.aliyun.com/ubuntu focal-proposed/restricted Translation-en [51.5 kB]
Get:46 http://mirrors.aliyun.com/ubuntu focal-proposed/restricted amd64 c-n-f Metadata [116 B]
Get:47 http://mirrors.aliyun.com/ubuntu focal-proposed/universe amd64 Packages [38.0 kB]
Get:48 http://mirrors.aliyun.com/ubuntu focal-proposed/universe Translation-en [19.4 kB]
Get:49 http://mirrors.aliyun.com/ubuntu focal-proposed/universe amd64 c-n-f Metadata [1772 B]
Get:50 http://mirrors.aliyun.com/ubuntu focal-proposed/multiverse amd64 Packages [7460 B]
Get:51 http://mirrors.aliyun.com/ubuntu focal-proposed/multiverse Translation-en [2348 B]
Get:52 http://mirrors.aliyun.com/ubuntu focal-proposed/multiverse amd64 c-n-f Metadata [312 B]
Fetched 22.1 MB in 5s (4912 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
192 packages can be upgraded. Run 'apt list --upgradable' to see them.
6. sudo apt install python3.8-venv
bash
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
libsigsegv2 pastebinit python3-newt run-one
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
libpython3.8 libpython3.8-dev libpython3.8-minimal libpython3.8-stdlib python3.8 python3.8-dev python3.8-minimal
Suggested packages:
python3.8-doc binfmt-support
The following NEW packages will be installed:
python3.8-venv
The following packages will be upgraded:
libpython3.8 libpython3.8-dev libpython3.8-minimal libpython3.8-stdlib python3.8 python3.8-dev python3.8-minimal
7 upgraded, 1 newly installed, 0 to remove and 185 not upgraded.
Need to get 10.8 MB of archives.
After this operation, 44.0 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://mirrors.aliyun.com/ubuntu focal-security/main amd64 python3.8-dev amd64 3.8.10-0ubuntu1~20.04.13 [514 kB]
Get:2 http://mirrors.aliyun.com/ubuntu focal-security/main amd64 libpython3.8-dev amd64 3.8.10-0ubuntu1~20.04.13 [3950 kB]
Get:3 http://mirrors.aliyun.com/ubuntu focal-security/main amd64 libpython3.8 amd64 3.8.10-0ubuntu1~20.04.13 [1625 kB]
Get:4 http://mirrors.aliyun.com/ubuntu focal-security/main amd64 python3.8 amd64 3.8.10-0ubuntu1~20.04.13 [387 kB]
Get:5 http://mirrors.aliyun.com/ubuntu focal-security/main amd64 libpython3.8-stdlib amd64 3.8.10-0ubuntu1~20.04.13 [1675 kB]
Get:6 http://mirrors.aliyun.com/ubuntu focal-security/main amd64 python3.8-minimal amd64 3.8.10-0ubuntu1~20.04.13 [1900 kB]
Get:7 http://mirrors.aliyun.com/ubuntu focal-security/main amd64 libpython3.8-minimal amd64 3.8.10-0ubuntu1~20.04.13 [720 kB]
Get:8 http://mirrors.aliyun.com/ubuntu focal-security/universe amd64 python3.8-venv amd64 3.8.10-0ubuntu1~20.04.13 [5452 B]
Fetched 10.8 MB in 1s (7955 kB/s)
(Reading database ... 45428 files and directories currently installed.)
Preparing to unpack .../0-python3.8-dev_3.8.10-0ubuntu1~20.04.13_amd64.deb ...
Unpacking python3.8-dev (3.8.10-0ubuntu1~20.04.13) over (3.8.10-0ubuntu1~20.04.11) ...
Preparing to unpack .../1-libpython3.8-dev_3.8.10-0ubuntu1~20.04.13_amd64.deb ...
Unpacking libpython3.8-dev:amd64 (3.8.10-0ubuntu1~20.04.13) over (3.8.10-0ubuntu1~20.04.11) ...
Preparing to unpack .../2-libpython3.8_3.8.10-0ubuntu1~20.04.13_amd64.deb ...
Unpacking libpython3.8:amd64 (3.8.10-0ubuntu1~20.04.13) over (3.8.10-0ubuntu1~20.04.11) ...
Preparing to unpack .../3-python3.8_3.8.10-0ubuntu1~20.04.13_amd64.deb ...
Unpacking python3.8 (3.8.10-0ubuntu1~20.04.13) over (3.8.10-0ubuntu1~20.04.11) ...
Preparing to unpack .../4-libpython3.8-stdlib_3.8.10-0ubuntu1~20.04.13_amd64.deb ...
Unpacking libpython3.8-stdlib:amd64 (3.8.10-0ubuntu1~20.04.13) over (3.8.10-0ubuntu1~20.04.11) ...
Preparing to unpack .../5-python3.8-minimal_3.8.10-0ubuntu1~20.04.13_amd64.deb ...
Unpacking python3.8-minimal (3.8.10-0ubuntu1~20.04.13) over (3.8.10-0ubuntu1~20.04.11) ...
Preparing to unpack .../6-libpython3.8-minimal_3.8.10-0ubuntu1~20.04.13_amd64.deb ...
Unpacking libpython3.8-minimal:amd64 (3.8.10-0ubuntu1~20.04.13) over (3.8.10-0ubuntu1~20.04.11) ...
Selecting previously unselected package python3.8-venv.
Preparing to unpack .../7-python3.8-venv_3.8.10-0ubuntu1~20.04.13_amd64.deb ...
Unpacking python3.8-venv (3.8.10-0ubuntu1~20.04.13) ...
Setting up libpython3.8-minimal:amd64 (3.8.10-0ubuntu1~20.04.13) ...
Setting up python3.8-minimal (3.8.10-0ubuntu1~20.04.13) ...
Setting up libpython3.8-stdlib:amd64 (3.8.10-0ubuntu1~20.04.13) ...
Setting up python3.8 (3.8.10-0ubuntu1~20.04.13) ...
Setting up libpython3.8:amd64 (3.8.10-0ubuntu1~20.04.13) ...
Setting up python3.8-venv (3.8.10-0ubuntu1~20.04.13) ...
Setting up libpython3.8-dev:amd64 (3.8.10-0ubuntu1~20.04.13) ...
Setting up python3.8-dev (3.8.10-0ubuntu1~20.04.13) ...
Processing triggers for libc-bin (2.31-0ubuntu9.9) ...
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for mime-support (3.64ubuntu1) ...