Import SYSSys.pathThe system environment is a list that allows you to add the libraries you need, such as MySQL libraries, hive libraries, and so on. There are three ways to add, all validated by:
1 temporarily added, in a shell windowImport SYSSys.pathsys.path.append (path)but exiting the shell window, which is invalid
2 permanently added using PTH files
using the PTH file, create the. pth file in the Site-packages file, write the path to the module, one line at a path, the following is an example, the PTH file can also use annotations:#. pth file for the My project (this line is a comment)E:\DjangoWordE:\DjangoWord\mysiteE:\DjangoWord\mysite\pollsThis is a good approach, but there are administrative issues and cannot be shared in different versions of Python
3 using Pythonpath environment variables using the PYTHONPATH environment variable, enter the relevant path in this environment variable, with a comma between the different paths (in English!). ) Separately, if the Pythonpath variable does not already exist, you can create it! paths are automatically added to Sys.path and can be shared in different versions of Python, which should be a convenient way
Adding environment variables in python