尽管成功安装了python3-venv和python3.8-venv,但仍找不到Ensurepip

j91ykkif  于 2023-03-13  发布在  Python
关注(0)|答案(1)|浏览(491)

尽管已经正确安装了所需的dev库和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.

当我运行sudoapt-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 not working with python3.8 -m venv env
  2. pyvenv not working because ensurepip is not available
    1.我也用“sudo dpkg-reconfigure locales”重置了区域设置,就像https://askubuntu.com/questions/33025/locale-settings-are-not-right-how-can-i-reset-them一样,但这可能是不相关的。
    ===更新===不知何故,卸载和重新安装python解决了这个venv问题,我也不确定为什么。
h79rfbju

h79rfbju1#

原来这是因为python安装失败了!由于sudo apt-get updatex 1 m1n1x使用不当(并且不小心),我的python安装失败了,无法正确找到它安装的库
我重新安装了python,现在可以了。
额外提示:由于我是在嵌入式计算机(dji manifold 2g)上使用这个程序,有些用户可能没有重新安装python的简单选择,重新刷新整个固件(python预装的)实际上可能更有帮助,尽管更不方便。

相关问题