Title here
Summary here
Our first program will print the classic “hello world” message. Here’s the full source code.
if __name__ == "__main__":
print("hello world")
To run the program, save the code in a hello_world.py
file and use the python
command.
$ python hello_world.py
hello world
Sometimes we’ll want to create a standalone executable. While Python is an interpreted language, we can use tools like PyInstaller
to package our scripts into executables.
First, install PyInstaller
using pip:
$ pip install pyinstaller
Then, package the script into an executable:
$ pyinstaller --onefile hello_world.py
$ ls dist/
hello_world
We can then execute the built executable directly.
$ ./dist/hello_world
hello world
Now that we can run and build basic Python programs, let’s learn more about the language.