自动生成环境依赖:
pip freeze > requirements.txt
其中会包含你所用的第三方包所自动安装的第三方包。
手动添加维护环境依赖(可以不加第三方包所自动安装的第三方包,但安装的时候会自动装上):
lxml==4.5.0
mysqlclient<=1.4.5
Pillow==7.1.2
pybloomfiltermmap3==0.5.2
requests==2.23.0
pymongo # 可以不加版本号,安装时自动安装最新版本
在新的环境自动一键安装新的依赖:
pip install -r requirements.txt
以后也可以尝试使用Pipenv。
需要发布到pypi上的第三方库最好要有setup.py文件。
参考资料:
https://pythonguidecn.readthedocs.io/zh/latest/writing/structure.html
https://blog.csdn.net/qq_37925422/article/details/79646462
https://blog.csdn.net/jazywoo123/article/details/37566587
https://www.jianshu.com/p/9acc85d0ff16