pip3异常No module named 'pip._internal'

pip升级后导致不能使用原来的pip命令,原先使用PyCharm安装pip,现使用easy_install安装最新版,导致冲突

1
2
3
> pip3 -V
...
ModuleNotFoundError: No module named 'pip._internal'

删除旧版pip

删除文件夹:

  • C:\Program Files\Python36\Lib\site-packages\pip
  • C:\Program Files\Python36\Lib\site-packages\pip-9.0.3.dist-info

使用easy_install安装新版pip

1
2
3
4
> cd C:\Users\yezhou\Desktop\setuptools-39.0.1
> python3 setup.py install
> cd C:\Program Files\Python36\Scripts
> easy_install pip

ensurepip

查看easy_install pip安装日志,下载新版whl,如:pip-10.0.0b2-py2.py3-none-any.whl

1
https://pypi.python.org/packages/97/72/1d514201e7d7fc7fff5aac3de9c7b892cd72fb4bf23fd983630df96f7412/pip-10.0.0b2-py2.py3-none-any.whl#md5=2671150c78981971c1dfbd175a42139c

放到 C:\Program Files\Python36\Lib\ensurepip_bundled 目录下

1
2
3
> python -m ensurepip
Requirement already satisfied: setuptools in c:\program files\python36\lib\site-packages
Requirement already satisfied: pip in c:\program files\python36\lib\site-packages\pip-10.0.0b2-py3.6.egg

验证

1
2
> pip3 -V
pip 10.0.0b2 from C:\Program Files\Python36\lib\site-packages\pip-10.0.0b2-py3.6.egg\pip (python 3.6)

Powered by AppBlog.CN     浙ICP备14037229号

Copyright © 2012 - 2020 APP开发技术博客 All Rights Reserved.

访客数 : | 访问量 :