‘pytest 不是内部或外部命令,也不是可运行的程序 或批处理文件。WARNING: The scripts pip.exe, pip3.8.exe and pip3.exe are install

输入命令pytest --version报错如下:
'pytest 不是内部或外部命令,也不是可运行的程序 或批处理文件。

输入命令pip list看到列表有pytest,但是C:\Program Files\Python38\Scripts文件夹里没有pytest.exe

输入命令pip uninstall pytest卸载pytest

输入命令pip install pytest再安装pytest的时候报错如下:
WARNING: The scripts pip.exe, pip3.8.exe and pip3.exe are installed in ‘C:\Program Files\Python38\Scripts’ which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.

网上找了很多方法都无法解决,使用命令python3 -m pip install pytest不行,卸载了重装也不行。

后来搜索python38发现卸载的时候是删了C:\Program Files\Python38这个地址的,除了这里,在C:\用户\user\AppData\Roaming\Microsoft\Windows\这里也有一个Python38的文件夹,里面有scripts文件夹,把这个地址的python38文件夹删除,再重新安装python38就行了

你可能感兴趣的:(python,pytest,python)