Python import modules

Posted by on Dec 30, 2011 in python | No Comments

Simple workaround to setting the environment variable, so that you can import custom modules saved at the specified path.

import os,sys
sys.path.append('/path/to/modules/')

Else to set the environment variable on the Mac by adding:

export PYTHONPATH=/path/to/modules/

to the .bashrc file

Email this to someoneTweet about this on TwitterShare on FacebookShare on Google+Share on LinkedInShare on StumbleUponShare on RedditDigg this

Leave a Reply