python-3.x - ModuleNotFoundError:使用 python3 时没有名为“apscheduler”的模块
问题描述
当我使用此命令启动我的项目时:
~/source/pydolphin on master! ⌚ 15:52:02
$ python3.9 schedulespider.py ‹ruby-2.7.2›
Traceback (most recent call last):
File "/Users/dolphin/source/pydolphin/schedulespider.py", line 4, in <module>
from apscheduler.schedulers.background import BackgroundScheduler
ModuleNotFoundError: No module named 'apscheduler'
(base)
然后我使用这个命令来安装apscheduler
:
conda install -c conda-forge apscheduler
但问题依然存在,我该怎么做才能解决它?这是我的 Python 代码:
# coding=utf-8
import time
from apscheduler.schedulers.background import BackgroundScheduler
from dolphin.biz.RssEntry import RssEntry
if __name__ == '__main__':
scheduler = BackgroundScheduler()
rss = RssEntry()
scheduler.add_job(rss.rss_sub, 'cron', minute='*/1', max_instances=10)
scheduler.start()
try:
while True:
time.sleep(20)
except (KeyboardInterrupt, SystemExit):
scheduler.shutdown()
解决方案
推荐阅读
- django - django + SSL 与本地服务器连接期间的浏览器错误
- amazon-web-services - DynamoDb 扫描返回 get、set 和 Observer?
- c++ - 警告 C26812:枚举类型没有作用域。更喜欢枚举类而不是枚举
- python - Pytorch 几何:张量大小有问题
- html - 媒体查询的宽度有问题,这就是为什么它根本没有响应
- mysql - 使用 JOIN 和 COUNT 查找总计 SQL
- c++ - 显示字符串时出现问题。字符串字段显示为空
- java - 为什么我无法使用类名属性在 Flipkart 中定位元素?
- apache-spark-sql - 有什么方法可以提高火花写入性能?
- regex - 必需的正则表达式验证开始两个固定字符,然后在数字固定字符之后