pip一段时间没用后出现这个问题,网上由解决方案
python -m ensurepip
python -m pip install --upgrade pip
但是报错
File "C:\Python310\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Python310\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "C:\Python310\lib\ensurepip\__main__.py", line 5, in <module>
sys.exit(ensurepip._main())
File "C:\Python310\lib\ensurepip\__init__.py", line 277, in _main
return _bootstrap(
File "C:\Python310\lib\ensurepip\__init__.py", line 193, in _bootstrap
return _run_pip([*args, *_PACKAGE_NAMES], additional_paths)
File "C:\Python310\lib\ensurepip\__init__.py", line 93, in _run_pip
return subprocess.run([sys.executable, '-W', 'ignore::DeprecationWarning',
File "C:\Python310\lib\subprocess.py", line 524, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['C:\\Python310\\python.exe', '-W', 'ignore::DeprecationWarning', '-c', '\nimport runpy\nimport sys\nsys.path = [\'C:\\\\Users\\\\LeeRX\\\\AppData\\\\Local\\\\Temp\\\\tmp5661mc2z\\\\setuptools-57.4.0-py3-none-any.whl\', \'C:\\\\Users\\\\LeeRX\\\\AppData\\\\Local\\\\Temp\\\\tmp5661mc2z\\\\pip-21.2.3-py3-none-any.whl\'] + sys.path\nsys.argv[1:] = [\'install\', \'--no-cache-dir\', \'--no-index\', \'--find-links\', \'C:\\\\Users\\\\LeeRX\\\\AppData\\\\Local\\\\Temp\\\\tmp5661mc2z\', \'setuptools\', \'pip\']\nrunpy.run_module("pip", run_name="__main__", alter_sys=True)\n']' returned non-zero exit status 1.
后来发现是python安装文件的用户权限有问题
修改用户权限为完全控制就好了。