When we started to learn Python development, we first wanted to understand what Python was, and to understand the environment and environment configuration of Python development, many friends in the Python environment configuration (http://www.maiziedu.com/course/python/ 276-2605/), there will be a variety of detail errors, resulting in a lot of wasted time to solve various problems. Therefore, the small part in this article to tell you about the Python environment variable setting method.
By default, after you install Python under Windows, the system does not automatically add the appropriate environment variables. You cannot use the Python command directly at the command line at this time.
1. First, you need to register the Python environment variable in the system: assuming that the Python installation path is c:\python2.6, modify the path in the system variable, advanced environment variable, properties----"
(in order to run the Python command in command-line mode, you need to append the directory where the Python.exe resides to the environment variable of path.) )
Path=path;c:\python26
Once the above environment variable is set up successfully, you can use the Python command directly at the command line. or execute "python *.py" to run the Python script.
2. At this point, you can still run Python scripts only through Python *.py, and if you want to run *.py directly, simply modify the other environment variable Pathext:
Pathext=pathext;. PY;. PYM
3. In addition, in the process of using Python, it may be necessary to review the help documentation for a command frequently, such as using "print" to view the instructions for use of the Print command. The default installation of Python is not able to view the help documentation, and it requires a simple configuration:
Under the Python installation directory, locate Python25.chm, using
Hh-decompile. Python26.chm
Decompile it, and then add the directory in which it resides to the PATH environment variable mentioned above.
4. How do I enable the Python interpreter to import directly from a third-party module other than the default installation path?
In order to import modules from a third party other than the default installation path (such as a module of your own), you need to create a new PYTHONPATH environment variable with the value of the directory where the module resides.
The above is the entire contents of the Python environment variable configuration,
Windows Python environment variable configuration