首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >已安装pytest,但在bash中运行“pytest”返回“Installed”

已安装pytest,但在bash中运行“pytest”返回“Installed”
EN

Stack Overflow用户
提问于 2018-11-05 12:56:51
回答 2查看 9.1K关注 0票数 11

我正在学习Vagrant中的python-django教程(Ubuntu18.04/ Python3.6.6)。运行pip3 install pytest-django并配置pytest.ini文件后,运行pytest返回

代码语言:javascript
复制
Command 'pytest' not found, but can be installed with:

apt install python-pytest
Please ask your administrator.

pip3 freeze输出:

代码语言:javascript
复制
pytest==3.10.0
pytest-django==3.4.3

这个装置还有别的地方吗?

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2018-11-05 13:19:44

试试python -m pytest

通过pip安装pytest并不使它成为一个系统命令,而是将其安装到python。-m命令将pytest作为自己的命令运行,然后任何正在进行的脚本都将是一个参数。

票数 18
EN

Stack Overflow用户

发布于 2022-04-04 13:35:48

当我想在.sh文件中运行以下代码时,遇到了问题。

代码语言:javascript
复制
pytest-3 -s test.py

为了解决这个问题,我从linux本身获得了如下解决方案:

代码语言:javascript
复制
sudo apt install python3-pytest
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/53154896

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档