Python: Custom Module Add path

Source: Internet
Author: User

Write yourself a Pyhton module each time in use to load their own modules are said that the module does not exist, and then found themselves on the Internet a total of three methods, have tried.

1:import SYS

Sys.path.append ("Add your Own module path"),//This method I want to vomit the trough is very troublesome, each time must add again, has been enough.

2: Add environment variables//This is also not recommended, after all, each time their own modules are not in the same directory.

3: Locate the site-packages in the Python installation path, such as ' E:\pythonfile\Lib\site-packages ', and create a new file with the suffix. PTH, for example Newpk.pth. Then notepad to open the file inside add their own definition of the module path, casually add, is not very convenient?

Python: Custom Module Add path

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.