How do I add a written script or a module to a Python search path?
>>>import sys>>> sys.path[', '/library/frameworks/python.framework/versions/3.4/lib/ Python34.zip ', '/library/frameworks/python.framework/versions/3.4/lib/python3.4 ', '/Library/Frameworks/ Python.framework/versions/3.4/lib/python3.4/plat-darwin ', '/library/frameworks/python.framework/versions/3.4/ Lib/python3.4/lib-dynload ', '/library/frameworks/python.framework/versions/3.4/lib/python3.4/site-packages ']# Out is a list of paths where Python will search for paths where the modules should be stored in the/LIBRARY/FRAMEWORKS/PYTHON.FRAMEWORK/VERSIONS/3.4/LIB/PYTHON3.4/ Site-packages>>>sys.path.append ("/desktop/python3.4/test.py") #把test. Py path Join the python search path >>> sys.path[', '/library/frameworks/python.framework/versions/3.4/lib/python34.zip ', '/Library/Frameworks/ python.framework/versions/3.4/lib/python3.4 ', '/library/frameworks/python.framework/versions/3.4/lib/python3.4/ Plat-darwin ', '/library/frameworks/python.framework/versions/3.4/lib/python3.4/lib-dynload ', '/Library/ Frameworks/python.framework/versions/3.4/lib/pythOn3.4/site-packages ', '/desktop/python3.4/test.py ']>>>import test ' hellow world '
Python Basics: Search Path