How to set the Python environment variable after you install Python

Source: Internet
Author: User

Life is short, I use Python. Recently there are many groups of Meng new in the Advisory Python installation matters, Python installation problem is not big, you can poke this article:. I thought that after the installation of Python will be all right, peace of mind, enter the command line python, found some errors.

Why do you still have this error when you have already installed Python? This is probably because you haven't set up a python environment variable yet. I'll teach you how to set up a python environment variable today.

1. First make sure Python is installed and know where your Python is installed. is a small part of the Python installation location, Python2 and Python3 are installed, the default is placed on the C drive.

2. Be sure to know the location of the Python installation, this matter is very important. Some small partners do not know how to copy the path, in fact, only need to click the path bar, as shown in.

3, this time the path will be covered with a veil, then CTRL + C can be copied, as shown in.

4, this time the path will become similar to the state: C:\Python27, the path of the backslash, this is the result we want. Of course this path is the Python installation path on my computer, each person's installation path may be different, just need to find the Python installation path, and then copy it.

5, after copying the Python path, go back to the desktop, find "My Computer", right-click, select "Properties", as shown in.

6. After the system interface pops up, then select "Advanced System Settings" in the left column.

7. Then pop up the "System Properties" screen, select the "Advanced" tab, and then click "Environment Variables" in the lower right, as shown in.

8. Then in the "Environment variables" dialog box that pops up, click "PATH" and then click on the "Edit" tab.

9. Then paste the path you just copied (the shortcut is CTRL + V) at the end of the "variable value" of the "edit user variable" that pops up. It is important to note that a semicolon is added before the path, which is a semicolon in the English state, indicating that it is separate from the path in the front and is another path. To put it bluntly, enter "under the variable value"; C:\Python27 "or"; Your Python installation path. " When you're done, click OK.

10. Enter cmd at this time, reopen a command-line window, and enter Python again, as shown in. At this point, you can see that Python has successfully set environment variables.

After that, the little friends can use python normally.

How to set the Python environment variable after you install Python

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.