APScheduler(高级Python调度器)导入错误:没有名为Scheduler的模块
我有以下导入错误 “导入错误:没有名为scheduler的模块” 当我运行以下python脚本时:APScheduler(高级Python调度器)导入错误:没有名为Scheduler的模块,python,Python,我有以下导入错误 “导入错误:没有名为scheduler的模块” 当我运行以下python脚本时: """ Demonstrates how to use the blocking scheduler to schedule a job that execute$ """ from datetime import datetime import os from apscheduler.scheduler import BlockingScheduler def tick(): prin
"""
Demonstrates how to use the blocking scheduler to schedule a job that execute$
"""
from datetime import datetime
import os
from apscheduler.scheduler import BlockingScheduler
def tick():
print('Tick! The time is: %s' % datetime.now())
if __name__ == '__main__':
scheduler = BlockingScheduler()
scheduler.add_job(tick, 'interval', seconds=3)
print('Press Ctrl+{0} to exit'.format('Break' if os.name == 'nt' else 'C'$
try:
scheduler.start()
except (KeyboardInterrupt, SystemExit):
pass
我已使用以下方式安装了APS计划程序:
sudo pip安装apscheduler
我还使用以下工具进行了升级:
sudo pip安装apscheduler--升级
还使用“sudo-apt-get-install-update&&sudo-apt-get-upgrade”升级了我的系统。您的导入错误。应该是:
from apscheduler.schedulers.blocking import BlockingScheduler
参考示例:
我也有同样的问题但后来我发现 我已经安装了apscheduler版本3 然后我使用
pip uninstall apscheduler
pip install apscheduler==2.1.2
如果您想使用版本3中添加的额外功能,只需在切换到版本2.1.2之前签出即可。就我而言,我并不想要太多。这里的url是invalid@SteveJiang:谢谢。固定的。
pip uninstall apscheduler
pip install apscheduler==2.1.2