Creating Python Files and Creating Python Environment under Ubuntu

1, Creating Python files

  1. Open the terminal in the directory where you want to create the Python file
  2. Using commands" Create an empty Python file with the file name "touch. py"
  3. Open the file with a text editor or use the command" Nano file name. py" Open the file
  4. Enter the code in the editor
  5. Click save or press" Ctrl+ X" Save

2, Creating a Python environment

1. Obtain root privileges on the system

sudo -i

2. View system environment variables

echo $PATH

3. Set Python environment variables

export PATH=/usr/bin/python3.8:$PATH

4. Review the system's environment variables again

echo $PATH