How to Set environment variables in Python

Source: Internet
Author: User

Python is a commonly used computer language in computer languages and has very powerful functions. Do you know how to set environment variables in Python? If you want to know the specific content, you can click the following article to learn about it.

How to Set environment variables in Python

Find the PATH in the system variable, double-click the PATH, and add "; C: \ Python25" (do not quote) at the end. Next, run-> cmd and enter python in the command line window to run the command.
Input

 
 
  1. print "Hello World!" 

The following results should be returned:

 
 
  1. >>> print "Hello World!"  
  2. Hello World! 

In the command line window, enter python in the Python article to set the classification of environment variables: Python Programming

 
 
  1. #!/usr/bin/python   
  2. #FileName:setDbgServerBridge.py   
  3. import os   
  4. path=os.environ["HOME"] + "/lib"   
  5. if os.path.exists(path)==False :   
  6. os.makedirs(path)   
  7. else:   
  8. print "exists"   
  9. dstFile=path + "/libeclipse_ct_debug_core_
    utility_DbgServerBridge.so"   
  10. srcFile="./libeclipse_ct_debug_core_
    utility_DbgServerBridge.so"   
  11. commandLine = "cp ./libeclipse_ct_debug_
    core_utility_DbgServerBridge.so " + dstFile   
  12. os.system(commandLine)   
  13. os.environ["LD_LIBRARY_PATH"]=path 

The above describes how to set environment variables in 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.