我有一个非常基本的Python程序,该程序会在某些时间间隔向您发出警报...我想使其成为一种软件,这样我就不必在每次打开计算机时都运行该程序... Windows和Linux...。还有一种通用的方法可以从任何语言的源代码创建可执行文件
For Linux , you can specify your .py(script) file and then have a cron job to run it based on your setup. You can schedule script to be executed periodically. Your cron job script can be edited as: Opens crontab edit:
# crontab -e
And add following entry if you want a scheduled job:
0 6 * * * /usr/bin/python your_script.py
So this will run every day at 6 am. For more options refer to http://www.adminschoice.com/crontab-quick-reference
Or if you want to add it to run at startup add the following entry:
@reboot /usr/bin/python your_script.py &
For Windows create a batch job and append it to your startup schedule, so this will run whenever you boot up your system.
batch file can be like(given you have a installed python version in your system):
@echo off python your_script.py PAUSE
Paste your batch file shortcut in above location.
For scheduled run for python script in windows refer to https://www.esri.com/arcgis-blog/products/product/analytics/scheduling-a-python-script-or-model-to-run-at-a-prescribed-time/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.