ModuleNotFoundError:No module named pip._internal

Uncategorized
529 words

笔者的ubuntu18.04发生这个错误是因为同时安装了两个python3(python3.6和python3.8)

step1

删除python3.6

sudo apt-get remove python3.6
sudo apt-get remove --auto-remove python3.6
sudo apt-get purge python3.6

step2

删除python3-pip

sudo apt-get remove  python3-pip

step3

重新安装python3-pip

sudo apt-get install python3-pip

此时运行pip3可能还是会报错

mykonos@DESKTOP-H37I3CV:~/pwndbg$ pip3
Traceback (most recent call last):
  File "/usr/local/bin/pip3", line 7, in <module>
    from pip._internal.cli.main import main
ModuleNotFoundError: No module named 'pip._internal'

step4

最后我们只需要更新一下pip,问题应该就结束了

python3 -m pip install --upgrade pip