官术网_书友最值得收藏!

Running the Hello World program

In the following steps, I will walk through how to run a program using the terminal.

1. In your Terminal program, go ahead and change the working directory to the directory containing your hello_world.py program:

$ cd <relative/path/to/directory>

2. Verify that you are in the correct directory by using the appropriate command for your operating system. Once you have verified that you are in the correct directory, run the program by entering either of the following, depending on your setup:

$ python hello_world.py 
$ python3 hello_world.py
Some operating systems will include a Python2 installation as   Python  and a Python3 installation as   python3. There may be additional variations of the python command that are used by default. See the installation instructions in the external resources for more details.
  1. Once you run the program, you should see printed out in your Terminal the words Hello World!. If you did, congratulations! You successfully ran your first program in Python:
This is what running the Hello World program looks like on my machine. Yours might be slightly different, so use the previous instructions, and not this, as a reference to run your program.
主站蜘蛛池模板: 张家界市| 依安县| 海口市| 江津市| 旺苍县| 宣恩县| 肥东县| 安国市| 攀枝花市| 兰州市| 剑阁县| 抚州市| 琼中| 金沙县| 栾川县| 鹤岗市| 中江县| 尉氏县| 博客| 都昌县| 乌拉特中旗| 元江| 兖州市| 永顺县| 乐亭县| 马山县| 焉耆| 宁陵县| 疏勒县| 松江区| 临桂县| 桂阳县| 南充市| 海口市| 廉江市| 石首市| 义乌市| 登封市| 加查县| 清水河县| 荣成市|