I. How do I add environment variables?
1. Right-click Add environment variable, select the directory to which you want to add environment variables----> right----->mark directory as------>sources Root
Add an environment variable to a file that turns blue
2. Via Sys.path.append (' directories to add environment variables ') or Sys.path.insert (0, ' directories to add environment variables ')
To obtain the absolute directory of the current directory as a reference, through the current directory to join the environment variable directory. Then add the environment variable
This is the recommended way to run your code on the command line or someone else without error.
Print (__file__) #不管什么时候, gets the absolute path to the current Python file
Get the current directory dynamically by '-file-', then take the correct path delimiter for the current file, and then take the parent directory or parent directory as required ....
Python-----Environment variables