在Python 3.8.3安装好后, 尝试更新pip时出现报错
C:\Users\vic>pip install --upgrade pip
Collecting pip
Downloading https://files.pythonhosted.org/packages/ac/cf/0cc542fc93de2f3b9b53cb979c7d1118cffb93204afb46299a9f858e113f/pip-21.1-py3-none-any.whl (1.5MB)
|████████████████████████████████| 1.6MB 930kB/s
Installing collected packages: pip
Found existing installation: pip 19.2.3
Uninstalling pip-19.2.3:
ERROR: Could not install packages due to an EnvironmentError: [WinError 5] 拒绝访问。: 'd:\\python3.8\\scripts\\pip.exe'
Consider using the `--user` option or check the permissions.
继续进行pip操作会显示找不到模块pip
C:\Users\vic>pip --version
Traceback (most recent call last):
File "d:\python3.8\lib\runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "d:\python3.8\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "D:\Python3.8\Scripts\pip.exe\__main__.py", line 5, in <module>
ModuleNotFoundError: No module named 'pip'
C:\Windows\System32>pip install scrapy
Traceback (most recent call last):
File "d:\python3.8\lib\runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "d:\python3.8\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "D:\Python3.8\Scripts\pip.exe\__main__.py", line 5, in <module>
ModuleNotFoundError: No module named 'pip'
C:\Windows\System32>python -m pip install -U --force-reinstall pip
D:\Python3.8\python.exe: No module named pip
C:\Windows\System32>pip list
Traceback (most recent call last):
File "d:\python3.8\lib\runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "d:\python3.8\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "D:\Python3.8\Scripts\pip.exe\__main__.py", line 5, in <module>
ModuleNotFoundError: No module named 'pip'
先执行 python -m ensurepip 然后执行 python -m pip install --upgrade pip 即可更新完毕
C:\Windows\System32>python -m ensurepip
Looking in links: c:\Users\vic\AppData\Local\Temp\tmpc2f7rix7
Requirement already satisfied: setuptools in d:\python3.8\lib\site-packages (41.2.0)
Collecting pip
Installing collected packages: pip
Successfully installed pip-19.2.3
C:\Windows\System32>python -m pip install --upgrade pip
Collecting pip
Using cached https://files.pythonhosted.org/packages/ac/cf/0cc542fc93de2f3b9b53cb979c7d1118cffb93204afb46299a9f858e113f/pip-21.1-py3-none-any.whl
Installing collected packages: pip
Found existing installation: pip 19.2.3
Uninstalling pip-19.2.3:
Successfully uninstalled pip-19.2.3
Successfully installed pip-21.1
在pip安装软件时需要使用管理员身份来下载,可以进入到cmd的System32文件夹,来进行下载:
C:\Users\vic>where cmd
C:\Windows\System32\cmd.exe
C:\Users\vic>cd C:\Windows\System32\cmd.exe
网友评论