Question

PYTHON 3.3 I have my HDD partitioned with programmes on "C" and data on "D" one NTFS and the other fat32. I've downloaded examples of code from one of the popular manuals onto "D". Running sys.path does not show these. I've looked, but cannot find the sys.path file to permanently add my "path". I can have the sys.path come up in IDLE, but making changes here are only temporary I believe. It is a small irritation to have to "go looking" each time. I'd really appreciate some comments, and apologize if this has already been answered somewhere else.

Was it helpful?

Solution

You can modify the environment variable PYTHONPATH to adjust the default path Python looks for modules when importing.

OTHER TIPS

For instance, to add the directory /home/me/mypy to the path, just do:

import sys

sys.path.append("/home/me/mypy")

source: http://www.johnny-lin.com/cdat_tips/tips_pylang/path.html

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top