簡體   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