You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

已安装python3-venv和python3.8-venv仍提示ensurepip缺失求助

Python3.8 venv创建报错(已安装对应venv包)

报错信息

已安装所需开发库和venv相关依赖,创建Python3.8虚拟环境时触发如下报错:

~/Desktop/virtualenvs$ python3.8 -m venv newpy38
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-get install python3-venv

You may need to use sudo with that command.  After installing the python3-venv
package, recreate your virtual environment.

Failing command: ['/home/dji/Desktop/virtualenvs/newpy38/bin/python3.8', '-Im', 'ensurepip', '--upgrade', '--default-pip']

依赖验证

运行如下命令确认venv相关包已正确安装:

  1. 验证系统默认venv包:
~/Desktop/virtualenvs$ sudo apt-get install python3-venv
Reading package lists... Done
Building dependency tree       
Reading state information... Done
python3-venv is already the newest version (3.6.7-1~18.04).
0 upgraded, 0 newly installed, 0 removed and 458 not upgraded.
  1. 验证Python3.8专属venv包:
~/Desktop/virtualenvs$ sudo apt-get install python3.8-venv
Reading package lists... Done
Building dependency tree       
Reading state information... Done
python3.8-venv is already the newest version (3.8.0-3~18.04.1).
0 upgraded, 0 newly installed, 0 removed and 458 not upgraded.

已尝试的无效操作

  • 社区公开的venv ensurepip缺失类报错通用解决方案
  • 执行sudo dpkg-reconfigure locales重置系统本地化配置(该操作与venv功能无直接关联)

最终解决方案

卸载当前Python3.8版本后重新安装,venv虚拟环境创建功能恢复正常,具体报错诱因暂未明确。

内容的提问来源于stack exchange,提问作者fatbringer

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.09.28 10:36:02