python - Crontab 没有在我的 Mac 上执行 Python 脚本?
问题描述
我可以在我的终端 /Users/quintus/opt/anaconda3/bin/python /Users/quintus/Desktop/python/04_Jobs/Jobs.py 中运行它
但是,我无法设置我的 crontab,我输入 48 23 * * * /Users/quintus/opt/anaconda3/bin/python /Users/quintus/Desktop/python/04_Jobs/Jobs.py
我阅读了类似的问题,但没有找到解决方案。
解决方案
我有一段时间没有在我的 Mac 上工作了,但我只是登录来测试一下。如果您尝试以下操作,它可能会起作用:
48 23 * * * python3 /Users/quintus/Desktop/python/04_Jobs/Jobs.py
这将使脚本在 Python 3.x 中运行,如果您想使用 Python 2.x,只需将 python3 替换为 python。我可能没有做一些额外的事情来让 python3 命令工作,但如果是这样的话,那是很久以前的事了。
此外,这将每 48 小时 23 分钟运行一次。我只想指出这一点,因为这似乎很奇怪。
推荐阅读
- c++ - C ++:用相同类型的新对象替换std :: vector“就地”中的对象,但保留对该对象的引用
- npm-live-server - Live-Server 扩展 VS 代码不起作用
- python - 如何选择所有标签HTML
- amazon-web-services - Amazon RDS 和 VPC 终端节点连接
- vue.js - 具有计算属性的 href 中的值不是动态的
- docker - 如何在两个服务之间共享 docker 卷,其中一个是事实来源?
- python - 并行化pytorch中的嵌套for循环
- python - python:pyti平均真实范围函数输入的列表结构
- django - django rest框架知道视图是类还是函数
- php - 如何使用 Laravel 在数据库中搜索未知的属性名称