当通过 ssh 运行 Pytest 测试时,我得到“没有名为 pandas 的模块";虽然安装了模块 [英] when running Pytest test through ssh I get "no module named pandas" although module is installed
问题描述
当通过 ssh
运行 Pytest
测试时,我得到no module named pandas
",尽管模块安装在虚拟环境和本地.
when running Pytest
test through ssh
I get "no module named pandas
" although module is installed both on vritual environment and locally.
谁能指出我还应该在哪里安装它?
Can somebody point out where else should I install it?
我访问我的服务器:
ssh user@server.com
输入密码
运行以下命令:py.test -s -v jupyter_test.py
".它运行测试,作为测试结果,我得到了上面提到的错误.
run the following command: "py.test -s -v jupyter_test.py
". It runs tests, and as test result I get above mentioned error.
当我在服务器上进行测试时,没有 ssh
,它运行良好.但我需要通过 ssh 来完成.
When I do test on server, without ssh
, it works perfectly. But I need to do it through ssh.
推荐答案
原因是远程机器上安装了旧版本的 Python,当我将脚本转换为 Python 3 时,它工作得很好.
the reason was that on remote machine there was installed old version of Python, when I converted script to Python 3 it worked just fine.
我用来转换脚本的命令是:
command I used to convert script is:
jupyter nbconvert --to script --execute --stdout file.ipynb | python3
这篇关于当通过 ssh 运行 Pytest 测试时,我得到“没有名为 pandas 的模块";虽然安装了模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!