python 3.8 venv 缺少激活命令

Ric*_*ard 9 python python-venv python-3.8

我在用户的主目录下编译了 Python 3.8.1

configure --prefix=/home/a_user/python3.8 --enable-shared
Run Code Online (Sandbox Code Playgroud)
  1. 当我尝试使用 venv 时,我得到:
python3 -m venv test_env
Error: Command '['/home/a_user/test_env/bin/python3', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1.
Run Code Online (Sandbox Code Playgroud)
  1. test_env 已创建但不完整:
test_env/
??? bin
?   ??? python -> python3
?   ??? python3 -> /home/a_user/python3.8/bin/python3
??? include
??? lib
?   ??? python3.8
?       ??? site-packages
??? lib64 -> lib
??? pyvenv.cfg

6 directories, 3 files
Run Code Online (Sandbox Code Playgroud)
  1. 确保pip确实存在:
python3 -m ensurepip
Looking in links: /tmp/tmpeqrn78f5
Requirement already satisfied: setuptools in ./python3.8/lib/python3.8/site-packages (41.2.0)
Requirement already satisfied: pip in ./python3.8/lib/python3.8/site-packages (19.2.3)
Run Code Online (Sandbox Code Playgroud)

所以我对缺少什么一无所知。

Ric*_*ard 7

最终的解决方案是:

python3 -m venv --without-pip test_env
source test_env/bin/activate
python3 -m ensurepip --upgrade
pip3 install --upgrade pip
Run Code Online (Sandbox Code Playgroud)

现在虚拟环境已完全设置并正常工作。