【已解决】pytest不是内部或外部命令,也不是可运行的程序 或批处理文件

在pycharm命令行运行pytest,报错:

pytest不是内部或外部命令,也不是可运行的程序 或批处理文件

如图:

 

 

原因:

python安装路径的Scripts目录下没有pytest.exe 

解决方法:

首先卸载在pycharm安装的pytest,命令行窗口执行“pip uninstall pytest ”

然后在python安装路径的Scripts目录下,打开命令窗口,执行“pip install pytest -i  https://pypi.douban.com/simple” 等待安装完成,执行“pytest --version”出现pytest版本号即安装成功

 

 

 再在pycharm命令行窗口运行即可:

 

 

posted @ 2021-01-15 17:31  小幸运||  阅读(5218)  评论(0)    收藏  举报