pip 安装six 报错 ModuleNotFoundError: No module named 'pip._internal.cli.main'

pip 安装six 报错 ModuleNotFoundError: No module named 'pip._internal.cli.main'

1、对 pip 进行升级

python -m pip install --upgrade pip

发现报错

Collecting pip
  Downloading https://files.pythonhosted.org/packages/54/2e/df11ea7e23e7e761d484ed3740285a34e38548cf2bad2bed3dd5768ec8b9/pip-20.1-py2.py3-none-any.whl (1.5MB)
     |████████████████████████████████| 1.5MB 595kB/s
Installing collected packages: pip
  Found existing installation: pip 19.3.1
    Uninstalling pip-19.3.1:
      Successfully uninstalled pip-19.3.1
  Rolling back uninstall of pip
  Moving to d:\program files\python3.6\lib\site-packages\pip-19.3.1-py3.6.egg
   from d:\program files\python3.6\lib\site-packages\~ip-19.3.1-py3.6.egg
  Moving to d:\program files\python3.6\scripts\pip.exe
   from C:\Users\Public\Documents\iSkysoft\CreatorTemp\pip-uninstall-39tpl7uw\pip.exe
  Moving to d:\program files\python3.6\scripts\pip3.6-script.py
   from C:\Users\Public\Documents\iSkysoft\CreatorTemp\pip-uninstall-39tpl7uw\pip3.6-script.py
  Moving to d:\program files\python3.6\scripts\pip3.6.exe
   from C:\Users\Public\Documents\iSkysoft\CreatorTemp\pip-uninstall-39tpl7uw\pip3.6.exe
  Moving to d:\program files\python3.6\scripts\pip3.exe
   from C:\Users\Public\Documents\iSkysoft\CreatorTemp\pip-uninstall-39tpl7uw\pip3.exe
ERROR: Exception:
Traceback (most recent call last):
  File "D:\Program Files\Python3.6\lib\site-packages\pip-19.3.1-py3.6.egg\pip\_internal\cli\base_command.py", line 153, in _main
    status = self.run(options, args)
  File "D:\Program Files\Python3.6\lib\site-packages\pip-19.3.1-py3.6.egg\pip\_internal\commands\install.py", line 455, in run
    use_user_site=options.use_user_site,
  File "D:\Program Files\Python3.6\lib\site-packages\pip-19.3.1-py3.6.egg\pip\_internal\req\__init__.py", line 62, in install_given_reqs
    **kwargs
  File "D:\Program Files\Python3.6\lib\site-packages\pip-19.3.1-py3.6.egg\pip\_internal\req\req_install.py", line 861, in install
    use_user_site=use_user_site, pycompile=pycompile,
  File "D:\Program Files\Python3.6\lib\site-packages\pip-19.3.1-py3.6.egg\pip\_internal\req\req_install.py", line 495, in move_wheel_files
    warn_script_location=warn_script_location,
  File "D:\Program Files\Python3.6\lib\site-packages\pip-19.3.1-py3.6.egg\pip\_internal\wheel.py", line 594, in move_wheel_files
    generated_console_scripts = maker.make_multiple(scripts_to_generate)
  File "D:\Program Files\Python3.6\lib\site-packages\pip-19.3.1-py3.6.egg\pip\_vendor\distlib\scripts.py", line 402, in make_multiple
    filenames.extend(self.make(specification, options))
  File "D:\Program Files\Python3.6\lib\site-packages\pip-19.3.1-py3.6.egg\pip\_internal\wheel.py", line 330, in make
    return super(PipScriptMaker, self).make(specification, options)
  File "D:\Program Files\Python3.6\lib\site-packages\pip-19.3.1-py3.6.egg\pip\_vendor\distlib\scripts.py", line 391, in make
    self._make_script(entry, filenames, options=options)
  File "D:\Program Files\Python3.6\lib\site-packages\pip-19.3.1-py3.6.egg\pip\_vendor\distlib\scripts.py", line 295, in _make_script
    self._write_script(scriptnames, shebang, script, filenames, ext)
  File "D:\Program Files\Python3.6\lib\site-packages\pip-19.3.1-py3.6.egg\pip\_vendor\distlib\scripts.py", line 231, in _write_script
    launcher = self._get_launcher('t')
  File "D:\Program Files\Python3.6\lib\site-packages\pip-19.3.1-py3.6.egg\pip\_vendor\distlib\scripts.py", line 370, in _get_launcher
    result = finder(distlib_package).find(name).bytes
AttributeError: 'NoneType' object has no attribute 'bytes'

接着对pip 进行强制升级

python -m pip install -U --force-reinstall pip


Collecting pip
  Using cached pip-20.1-py2.py3-none-any.whl (1.5 MB)
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 20.1
    Uninstalling pip-20.1:
      Successfully uninstalled pip-20.1
Successfully installed pip-20.1

到这里终于对 pip 升级的问题解决

接下来看刚开始的问题是否解决

pip install six
Requirement already satisfied: six in d:\program files\python3.6\lib\site-packages (1.12.0)
Could not build wheels for six, since package 'wheel' is not installed.

看执行解决似乎已经解决,但是新的问题又出现了 说wheel 没有被安装,接下来安装wheel

pip install wheel
Collecting wheel
  Downloading wheel-0.34.2-py2.py3-none-any.whl (26 kB)
Installing collected packages: wheel
Successfully installed wheel-0.34.2

安装成功,至此问题解决

猜你喜欢

转载自www.cnblogs.com/ningy1009/p/12807283.html
今日推荐