- Python Programming with Raspberry Pi
- Sai Yamanoor Srihari Yamanoor
- 136字
- 2021-07-02 23:48:42
Executing Python scripts using the Linux Terminal
It is possible to execute code written using any text editor via the Linux Terminal. For example, Let's say the file helloworld.py is saved in a folder named code_samples on the Raspberry Pi's desktop. This file may be executed as follows from the Linux Terminal:
If you are not familiar with the Linux command-line terminal, we have written up some tutorials to familiarize yourself with the command-line terminal on this book's website.
- On the Linux Terminal, switch to the directory where the Python script is located:
cd /home/pi/Desktop/code_samples
- Execute the Python script as follows:
python3 helloworld.py
- Alternatively, the Python script could be executed using its absolute location path:
python3 /home/pi/Desktop/code_samples/hello_world.py
We did it! We just wrote our first piece of code and discussed different ways to execute the code.
推薦閱讀
- Hands-On Deep Learning with Apache Spark
- 亮劍.NET:.NET深入體驗(yàn)與實(shí)戰(zhàn)精要
- AWS:Security Best Practices on AWS
- Visual FoxPro 6.0數(shù)據(jù)庫(kù)與程序設(shè)計(jì)
- 圖形圖像處理(Photoshop)
- Pig Design Patterns
- Photoshop CS3圖像處理融會(huì)貫通
- 新手學(xué)電腦快速入門
- 數(shù)據(jù)庫(kù)系統(tǒng)原理及應(yīng)用教程(第5版)
- Prometheus監(jiān)控實(shí)戰(zhàn)
- 人工智能趣味入門:光環(huán)板程序設(shè)計(jì)
- Building a BeagleBone Black Super Cluster
- 基于ARM9的小型機(jī)器人制作
- TensorFlow Deep Learning Projects
- C#求職寶典