Python environment variable configuration in Windows

Source: Internet
Author: User

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: (in order to run the pythoncommand in the command line, the directory where python.exe is located is appended 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. in this case, you can only use "python *. py "run the python script, 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 frequently view the help document of a command when using python, such as using help ('print ') to view the instructions for using the print command. Python installed by default cannot view help documentation. You still need to perform simple configuration: Find python25.chm In the python installation directory and use hh-decompile. python26.chm decompile 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) other than the default installation path, you need to create a new PYTHONPATH environment variable. The value is the directory where the module is located.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.