3

Where is my pythonpath stored? When I write

import sys
sys.path

Where does Python get that data?

1
  • any reason you want to know where it is stored? If you want python to use a different pythonpath, you could set the environment variable: PYTHONPATH. Commented Aug 5, 2010 at 11:53

1 Answer 1

2

Python gets that data from the path attribute of the sys module. This path is a list, and if you want to add a new directory to the path, just use the append method.

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

import sys
sys.path.append("/home/me/mypy")
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.