Thursday, April 6, 2017

python 添加自己开发的模块

  1. 定位模块文件地址的方法
import codecs
codecs.__file__

打印Python系统路径
import sys
sys.path

  1. 添加自己的模块

here are a few ways. One of the simplest is to create a my-paths.pth file (as described here). This is just a file with the extension .pth that you put into your system site-packages

在site-packages中添加一个文件my-paths.pth,其中pth文件中添加自己的模块地址就行了




扩展 Python的内置函数

No comments:

Post a Comment