+关注
已关注

分类  

暂无分类

标签  

暂无标签

日期归档  

2020-03(62)

2020-04(60)

2020-05(24)

2020-06(39)

2020-07(23)

ModuleNotFoundError: No module named 'pip._internal' , pip 无法下载软件 解决办法

发布于2020-03-27 09:25     阅读(845)     评论(0)     点赞(19)     收藏(3)


0

1

2

3

4

5

6

环境: win10 
            python3.6 虚拟环境 

pip命令报错: ModuleNotFoundError: No module named 'pip._internal.cli.main'

  1. (pywork) D:\Anaconda3\pyenv>pip list
  2. Traceback (most recent call last):
  3. File "D:\Anaconda3\envs\pywork\Scripts\pip-script.py", line 6, in <module>
  4. from pip._internal.cli.main import main
  5. ModuleNotFoundError: No module named 'pip._internal.cli.main'
  6. (pywork) D:\Anaconda3\pyenv>python -m ensurepip
  7. Requirement already satisfied: setuptools in d:\anaconda3\envs\lib\site-packages\setuptools-40.8.0-py3.6.egg
  8. Requirement already satisfied: pip in d:\anaconda3\envs\lib\site-packages\pip-19.0.3-py3.6.egg

看网上说有可能是与旧版冲突,所以可能事先卸载旧版。

输入以下命令以期解决问题:

  1. python -m ensurepip
  2. python -m pip install --upgrade pip

 结果:没有解决问题,反而报错:AttributeError: 'NoneType' object has no attribute 'bytes'

  1. (pywork) D:\Anaconda3\pyenv>python -m ensurepip
  2. Requirement already satisfied: setuptools in d:\anaconda3\envs\lib\site-packages\setuptools-40.8.0-py3.6.egg
  3. Requirement already satisfied: pip in d:\anaconda3\envs\lib\site-packages\pip-19.0.3-py3.6.egg
  4. (pywork) D:\Anaconda3\pyenv>python -m pip install --upgrade pip
  5. Collecting pip
  6. Using cached https://files.pythonhosted.org/packages/54/0c/d01aa759fdc501a58f431eb594a17495f15b88da142ce14b5845662c13f3/pip-20.0.2-py2.py3-none-any.whl
  7. Installing collected packages: pip
  8. Found existing installation: pip 19.0.3
  9. Uninstalling pip-19.0.3:
  10. Successfully uninstalled pip-19.0.3
  11. Rolling back uninstall of pip
  12. Moving to d:\anaconda3\envs\lib\site-packages\pip-19.0.3-py3.6.egg
  13. from d:\anaconda3\envs\lib\site-packages\~ip-19.0.3-py3.6.egg
  14. Moving to d:\anaconda3\envs\scripts\pip-script.py
  15. from C:\Users\daqsoft\AppData\Local\Temp\pip-uninstall-7i37rfp4\pip-script.py
  16. Moving to d:\anaconda3\envs\scripts\pip.exe
  17. from C:\Users\daqsoft\AppData\Local\Temp\pip-uninstall-7i37rfp4\pip.exe
  18. Moving to d:\anaconda3\envs\scripts\pip3-script.py
  19. from C:\Users\daqsoft\AppData\Local\Temp\pip-uninstall-7i37rfp4\pip3-script.py
  20. Moving to d:\anaconda3\envs\scripts\pip3.6-script.py
  21. from C:\Users\daqsoft\AppData\Local\Temp\pip-uninstall-7i37rfp4\pip3.6-script.py
  22. Moving to d:\anaconda3\envs\scripts\pip3.6.exe
  23. from C:\Users\daqsoft\AppData\Local\Temp\pip-uninstall-7i37rfp4\pip3.6.exe
  24. Moving to d:\anaconda3\envs\scripts\pip3.exe
  25. from C:\Users\daqsoft\AppData\Local\Temp\pip-uninstall-7i37rfp4\pip3.exe
  26. Exception:
  27. Traceback (most recent call last):
  28. File "D:\Anaconda3\envs\lib\site-packages\pip-19.0.3-py3.6.egg\pip\_internal\cli\base_command.py", line 179, in main
  29. status = self.run(options, args)
  30. File "D:\Anaconda3\envs\lib\site-packages\pip-19.0.3-py3.6.egg\pip\_internal\commands\install.py", line 393, in run
  31. use_user_site=options.use_user_site,
  32. File "D:\Anaconda3\envs\lib\site-packages\pip-19.0.3-py3.6.egg\pip\_internal\req\__init__.py", line 57, in install_given_reqs
  33. **kwargs
  34. File "D:\Anaconda3\envs\lib\site-packages\pip-19.0.3-py3.6.egg\pip\_internal\req\req_install.py", line 913, in install
  35. use_user_site=use_user_site, pycompile=pycompile,
  36. File "D:\Anaconda3\envs\lib\site-packages\pip-19.0.3-py3.6.egg\pip\_internal\req\req_install.py", line 445, in move_wheel_files
  37. warn_script_location=warn_script_location,
  38. File "D:\Anaconda3\envs\lib\site-packages\pip-19.0.3-py3.6.egg\pip\_internal\wheel.py", line 544, in move_wheel_files
  39. generated.extend(maker.make(spec))
  40. File "D:\Anaconda3\envs\lib\site-packages\pip-19.0.3-py3.6.egg\pip\_vendor\distlib\scripts.py", line 405, in make
  41. self._make_script(entry, filenames, options=options)
  42. File "D:\Anaconda3\envs\lib\site-packages\pip-19.0.3-py3.6.egg\pip\_vendor\distlib\scripts.py", line 309, in _make_script
  43. self._write_script(scriptnames, shebang, script, filenames, ext)
  44. File "D:\Anaconda3\envs\lib\site-packages\pip-19.0.3-py3.6.egg\pip\_vendor\distlib\scripts.py", line 245, in _write_script
  45. launcher = self._get_launcher('t')
  46. File "D:\Anaconda3\envs\lib\site-packages\pip-19.0.3-py3.6.egg\pip\_vendor\distlib\scripts.py", line 384, in _get_launcher
  47. result = finder(distlib_package).find(name).bytes
  48. AttributeError: 'NoneType' object has no attribute 'bytes'

解决方法:

easy_install -U pip

结果显示如下,成功解决问题。

  1. Searching for pip
  2. Reading https://pypi.org/simple/pip/
  3. Downloading https://files.pythonhosted.org/packages/54/0c/d01aa759fdc501a58f431eb594a17495f15b88da142ce14b5845662c13f3/pip-20.0.2-py2.py3-none-any.whl#sha256=4ae14a42d8adba3205ebeb38aa68cfc0b6c346e1ae2e699a0b3bad4da19cef5c
  4. Best match: pip 20.0.2
  5. Processing pip-20.0.2-py2.py3-none-any.whl
  6. Installing pip-20.0.2-py2.py3-none-any.whl to d:\anaconda3\envs\lib\site-packages
  7. Adding pip 20.0.2 to easy-install.pth file
  8. Installing pip-script.py script to D:\Anaconda3\envs\Scripts
  9. Installing pip.exe script to D:\Anaconda3\envs\Scripts
  10. Installing pip3-script.py script to D:\Anaconda3\envs\Scripts
  11. Installing pip3.exe script to D:\Anaconda3\envs\Scripts
  12. Installing pip3.8-script.py script to D:\Anaconda3\envs\Scripts
  13. Installing pip3.8.exe script to D:\Anaconda3\envs\Scripts

 

原文链接:https://blog.csdn.net/qq_36535820/article/details/105124346

0

1

2

3

4

5

6



所属网站分类: 技术文章 > 博客

作者:9384vfnv

链接: https://www.pythonheidong.com/blog/article/286656/b154e7c333d1d9684d1e/

来源: python黑洞网

任何形式的转载都请注明出处,如有侵权 一经发现 必将追究其法律责任

19 0
收藏该文
已收藏

评论内容:(最多支持255个字符)