carl crott
carl crott

Reputation: 753

Modifying default module source paths in python at the language level

1) I don't want to run git on my usr/local/lib

2) I would prefer to store this module within a /home/thrive/python_projects folder

3) I'm attempting to change where python sources the module from, when using the "import" statement

I've found a few leads and I plan to post the answer here when I get it.

leads:

SO far the best suggestion is modifying the system path. However I believe that modifying the source with the language itself would be better for an open source project.

So how can I change this in Python?

Upvotes: 0

Views: 77

Answers (2)

imsc
imsc

Reputation: 7840

In linux/unix add the path to the folder in the .bashrc file. E.g.,

export PYTHONPATH="/home/usrName/usr/lib/python:/home/usrName/SomeOtherFolder/:"

will add two directories to the python path.

Upvotes: 2

Tom
Tom

Reputation: 22841

Can you explain why you're looking to do this? If it's because you need to have different versions of a module on your machine, that's a problem virtualenv solves for you. I'm not sure what you're trying to do, but it definitely sounds like a job for virtualenv.

Upvotes: 0

Related Questions