繁体   English   中英

尽管成功安装了 python3-venv 和 python3.8-venv,但没有找到 ensurepip

[英]Ensurepip is not found despite successfully installing python3-venv and python3.8-venv

尽管正确安装了所需的开发库和 venv 库,但我还是收到了这些连续的错误。

这是终端中的连续输出。

~/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']

当我运行 sudo apt-get 以确定我已经安装了 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 to remove and 458 not upgraded.

当我再次运行 sudo apt-get 来确定时,我已经安装了 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 to remove and 458 not upgraded.

我也尝试了以下链接,但无济于事:

  1. python3.8-venv 不适用于 python3.8 -m venv env
  2. pyvenv 不工作,因为 ensurepip 不可用
  3. 我还使用“sudo dpkg-reconfigure locales”的语言环境进行了重置,如https://askubuntu.com/questions/33025/locale-settings-are-not-right-how-can-i-reset-them 但这可能是无关的。

=== 更新=== 不知何故,卸载并重新安装python 解决了这个venv 问题。 我也不知道为什么。

原来这是因为 python 安装损坏! 由于sudo apt-get update sudo apt-get autoremove小心),我最终安装了损坏的 python,无法正确找到其安装的库

我重新安装了python,现在可以了。

额外注意:当我在嵌入式计算机(dji manifest2g)上使用它时,一些用户可能没有重新安装 python 的简单选项。 重新刷新整个固件(随 python 预装)实际上可能更有帮助,尽管更不方便。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM