hal_v
hal_v

Reputation: 151

Modifying sys.path

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.

Upvotes: 2

Views: 3752

Answers (2)

kHr
kHr

Reputation: 1

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

Upvotes: 0

poke
poke

Reputation: 387507

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

Upvotes: 2

Related Questions