Created
January 30, 2015 17:19
-
-
Save zstumgoren/2f1a4866d5f93d9d78cb to your computer and use it in GitHub Desktop.
example of modifying python module search path
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| >>> import sys,pprint | |
| >>> pprint.pprint(sys.path) | |
| ['', | |
| '/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg', | |
| '/Library/Python/2.7/site-packages/six-1.8.0-py2.7.egg', | |
| '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', | |
| '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7', | |
| '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', | |
| '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', | |
| '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', | |
| '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python', | |
| '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', | |
| '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old', | |
| '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload', | |
| '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC', | |
| '/Library/Python/2.7/site-packages'] | |
| #Now let's add some random path to the end of the search path | |
| >>> sys.path.append("/path/to/some/directory") | |
| >>> pprint.pprint(sys.path) | |
| ['', | |
| '/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg', | |
| '/Library/Python/2.7/site-packages/six-1.8.0-py2.7.egg', | |
| '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', | |
| '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7', | |
| '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', | |
| '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', | |
| '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', | |
| '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python', | |
| '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', | |
| '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old', | |
| '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload', | |
| '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC', | |
| '/Library/Python/2.7/site-packages', | |
| '/path/to/some/directory'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment