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
安裝成功,至此問題解決