Configure python environment variables in Windows (23:40:14) Reprinted
By default, after python is installed in windows, the system does not automatically add corresponding environment variables. In this case, you cannot directly use python commands in the command line. 1. first, you must register the python environment variable in the system. Assume that the python installation path is c: \ python2.6, modify the PATH in my computer> Properties> advanced> environment variables> system variables: (To run the pythoncommand in the command line, add the directory of python.exe to the path environment variable .) PATH = PATH; c: \ python26 After the preceding environment variables are successfully set, you can directly use the python command on the command line. Or run "python *. py" to run the python script. 2. At this time, you can only run the python script through "python *. py". If you want to directly run *. py, you only need to modify another environment variable PATHEXT: PATHEXT = PATHEXT;. PY;. PYM 3. In addition, you may need to check the help document of a command frequently when using python, such as using help ('print ') to view the instructions for using the print command. Python installed by default cannot view the help documentation, and simple configuration is required: In the python installation directory, find python25.chm and useHh-decompile. python26.chmDecompile it and add the directory to the PATH environment variable mentioned above. 4.How can I enable the Python interpreter to directly import third-party modules other than the default installation path? To import third-party modules (such as self-written modules) outside the default installation path, you need to create a new PYTHONPATH environment variable with the value of the directory where the module is located. |