在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命令行窗口运行即可: