使用pip install pytest 安装pytest,输入命令回车显示:
WARNING: You are using pip version 21.3.1; however, version 22.0.3 is available.
You should consider upgrading via the 'd:\python3.8\python.exe -m pip install --upgrade pip' command.
这说明pip的版本老旧,需要升级新的版本,使用pip install --upgrade pip 去升级pip,但是又报错了:
ERROR: Could not install packages due to an OSError: [WinError 5] 拒绝访问。: 'd:\\python3.8\\scripts\\pip.exe'
Consider using the `--user` option or check the permissions.
切换升级语句为python.exe -m pip install --upgrade pip 但是又提示错误:
d:\python3.8\python.exe: No module named pip
这可能是与旧版本冲突了,所以需要解决旧版本的问题:
>python -m ensurepip
>python -m pip install --upgrade pip
至此,安装了pip的最新版本,可以继续安装pytest。
|