How do I make a python executable in Linux?

Giang Phạm

New member
How do I make a python executable in Linux?
Answer
Making a Python script executable and runnable from anywhere
  1. Add this line as the first line in the script: #!/usr/bin/env python3.
  2. At the unix command prompt, type the following to make myscript.py executable: $ chmod +x myscript.py.
  3. Move myscript.py into your bin directory, and it will be runnable from anywhere.
 

Tìm kiếm

Back
Top