setuptools
python包的根目录设置setup.py
from setuptools import setup, find_packages setup(
name = 'm'
version = '0.1.0'
packages = find_packages() # 自动找出包内内容
install_requires = ['requests >= 2.9.0'] # 自动安装依赖,可以指定版本
)
python setup.py build
python setup.py install
pip
pip freeze # 列出当前所有已安装的库
pip freeze > requirments.txt # 将依赖包定向到文件
pip install -r requirments.txt # 读入安装依赖包