简体   繁体   English

未找到 PythonAnywhere 模块

[英]PythonAnywhere module not found

I set up a task on PythonAnywhere to run a file every day however when it came time to run it, it said that "No module named pyowm.owm".我在 PythonAnywhere 上设置了一个任务来每天运行一个文件,但是当运行它时,它说“没有名为 pyowm.owm 的模块”。 However when I run the finally normally in the file section of PythonAnywhere it runs perfectly fine.但是,当我在 PythonAnywhere 的文件部分中正常运行 finally 时,它运行得非常好。 I've tried installing the modules for both Python 3.7 and 3.8 however neither have worked.我已经尝试为 Python 3.7 和 3.8 安装模块,但都没有成功。

You need to specify Python executable for the script either by adding a shebang #./usr/bin/python3.8 at the beginning of the script or by defining the scheduled task's command like: python3.8 /home/myusername/myproject/myscript.py (examples are for Python 3.8).您需要为脚本指定 Python 可执行文件,方法是在脚本开头添加 shebang #./usr/bin/python3.8或定义计划任务的命令,例如: python3.8 /home/myusername/myproject/myscript.py (示例适用于 Python 3.8)。 You may use a virtualenv as well, in such case the command should look like: /home/myusername/.virtualenvs/myvenv/bin/python /home/myusername/myproject/mytask.py .您也可以使用 virtualenv,在这种情况下,命令应如下所示: /home/myusername/.virtualenvs/myvenv/bin/python /home/myusername/myproject/mytask.py

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM