添加 module 到 python 的 path 中(自动找到module)

import sys

# 查看系统的 module 路径
print sys.path

# 然后添加 module 到 python 的 path 中:
# 方法一:环境变量 PYTHONPATH 中包含 module 所在的路径
#		shell中:export PYTHONPATH=modulePath
#
# 方法二:编程中直接指定我们的 module 路径到 sys.path 中

sys.path.append('/a/b/c')
print sys.path

转载自:https://blog.csdn.net/xueyingxue001/article/details/52159764

You may also like...