Go to: Configure python environment variables in Windows

Source: Internet
Author: User
Configure the python environment variable in Windows
Configure python environment variables in Windows

(23:40:14)

Reprinted
Tags:

Miscellaneous

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.

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.