Python development Environment (2): Pythonpath changes detected when you start eclipse

Source: Internet
Author: User

Os:windows 10 Home Chinese version, eclipse:oxygen.1a release (4.7.1a), pydev:6.3.2

On April 25, Pydev was installed on Eclipse (recorded in the previous blog post) and a Python project was developed that did not attempt to develop the Django project;

May 2, using the downloaded Django installation package, the Django 2.0 is installed in Python 3.6.3;

May 5 (today), when you open Eclipse, the following window pops up, prompting "System PYTHONPATH changes detected"

Cause, I installed Django after installing Pydev, and I installed Django to change the python environment variable PYTHONPATH, so when you open eclipse

When it detects a change, it prompts the user to use the new Pythonpath.

Default Select all, directly click the button "Apply selected changes" can.

What's the problem if you don't change it? maybe some newly installed Python modules won't work! ( tests are required )

What is Pythonpath?

One of the search paths in the Python program import module, ranked second, consists of a number of paths.

The value of Pythonpath can be obtained through print (Sys.path) or print (Os.sys.path) .

Question: What is the difference between OS module and SYS module? Do I need import when I use it?

The Import module search order for Python:

1. Program Master Directory

Directories in 2.PYTHONPATH

Standard library directories and third-party directories (such as the Django directory mentioned in this article)

3. Any. pth file can be found?

Reference: Python module search path

My site.getsitepackages () returns the result:

4. Site-packages directory for third-party extensions

The Site-packages ( already present in Pythonpath ) under the Lib directory in the Python home directory.

Note that it is not found in the directory above, it will produce an import exception , and only the specified directory will not be searched recursively (enter

Directory below the above directory).

note that Windows first searches for "." directory, which is the current path, and linux will only be searched from the path of the environment variable (UNIX?). Linux also needs to be verified ).

Type of path:

1. Normal path

e.g. C:\\python36\\lib

2. Dictionaries

e.g.?

3.ZIP file

e.g. C:\\python36\\python36.zip

4.egg file (python egg, python eggs)

e.g. C:\\python36\\lib\\site-packages\\django-2.0.3-py3.6.egg

Description, the. Egg file, is a package created by the Setuptools library, with a ZIP file that adds metadata (version number, dependencies, and so on).

Reference Links:

Python environment variable Pythonpath settings
Python Modular Module Search order, repeat import, module load list (v)
Python Module Search Path

Python development Environment (2): Pythonpath changes detected when you start eclipse

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.