why their is a difference between os.getenv('PATH') and sys.path ?

Recommended Answers

os.getenv('PATH') is the sequence of folders where the operating system finds executable programs. sys.path is the sequence of folders where python finds importable modules.

Jump to Post

All 3 Replies

I think doc explain it ok os.getenv() and sys.path

A simplified explation of some use of those could be.
If i want to import a Python module made by me or other,i have to make sure it is in sys.path so Python can find it.

In my windows environment variables i have add ;C:\python27\;C:\python27\scripts;
This mean that i type just Python in cmd(command line) to start Python.
os.getenv('path') give me back all path that's in my Windows environment variables(path).

os.getenv('PATH') is the sequence of folders where the operating system finds executable programs. sys.path is the sequence of folders where python finds importable modules.

I knew what gives meach of those but I still posted it...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.