I have made an alexa like program on python. Now, I want it to auto run when I start my computer and take inputs and give outputs as well. How do I do it?
First make sure you add this line to the top of your python program.
#!/usr/bin/python3
sudo cp -i /path/to/your_script.py /bin
sudo crontab -e
This command will open the cron file.
@reboot python /bin/your_script.py &
You can add any command to run in the startup in the cron file.
Cron can be used to perform any kind of scheduling other than startup also.
Navigate to C:\Users\ username
\Appdata\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
Place your complied exe
file there, it will be executed on startup.
To make exe from py, first install the pyinstaller module pip install pyinstaller
.
Now run the command in the folder where the python file is pyinstaller --onefile your_script.py
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.