Adding environment variables in python

Source: Internet
Author: User

Import SYSSys.pathThe system environment is a list that allows you to add the libraries you need, such as MySQL libraries, hive libraries, and so on. There are three ways to add, all validated by:   1 temporarily added, in a shell windowImport SYSSys.pathsys.path.append (path)but exiting the shell window, which is invalid   2 permanently added using PTH files  using the PTH file, create the. pth file in the Site-packages file, write the path to the module, one line at a path, the following is an example, the PTH file can also use annotations:#. pth file for the My project (this line is a comment)E:\DjangoWordE:\DjangoWord\mysiteE:\DjangoWord\mysite\pollsThis is a good approach, but there are administrative issues and cannot be shared in different versions of Python   3 using Pythonpath environment variables using the PYTHONPATH environment variable, enter the relevant path in this environment variable, with a comma between the different paths (in English!). ) Separately, if the Pythonpath variable does not already exist, you can create it!  paths are automatically added to Sys.path and can be shared in different versions of Python, which should be a convenient way

Adding environment variables in python

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.