Python import modules

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

[py collapse=”False”]
import os,sys
sys.path.append(‘/path/to/modules/’)
[/py]

Else to set the environment variable on the Mac by adding:
[py collapse=”False”]
export PYTHONPATH=/path/to/modules/
[/py]
to the .bashrc file

Post a comment

You may use the following HTML:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>