Python的开发环境

setup.py

编写python的第三方库,最终要的一个工作就是编写setup.py了,其实如果我们下载过一些第三库的源代码文件,打开之后一般就会有一个setup.py,执行python setup.py install 就可以安装这个库了

from distutils.core import setup

#This is a list of files to install, and where
#(relative to the 'root' dir, where setup.py is)
#You could be more specific.
files = ["things/*"]

setup(name = "appname",
    version = "100",
    description = "yadda yadda",
    author = "myself and I",
    author_email = "email@someplace.com",
    url = "whatever",
    #Name the folder where your packages live:
    #(If you have other packages (dirs) or modules (py files) then
    #put them into the package directory - they will be found 
    #recursively.)
    packages = ['package'],
    #'package' package must contain files (see list above)
    #I called the package 'package' thus cleverly confusing the whole issue...
    #This dict maps the package name =to=> directories
    #It says, package *needs* these files.
    package_data = {'package' : files },
    #'runner' is in the root.
    scripts = ["runner"],
    long_description = """Really long text here.""" 
    #
    #This next part it for the Cheese Shop, look a little down the page.
    #classifiers = []     
)

写完之后运行下面的命令

python setup.py sdist

在当前目录下,会创建dist目录,里面有个文件名为foo-1.0.tar.gz,这个就是可以分发的包。使用者拿到这个包后,解压,到foo-1.0目录下执行:python setup.py install。

buildout

buildout的是一款自动化构建工具。
由Zope团队开发维护。包名为zc.buildout。
buildout可以为应用构建独立的依赖环境。类似于virtualenv/miniconda,但二者还有不同。
粗略地讲,buildout支持的功能更多更便于自动化而且具体定位有所不同。

pip

easy_install 和 pip的介绍:
easy_install和pip都是用来下载安装Python一个公共资源库PyPI
的相关资源包的,pip是easy_install的改进版,提供更好的提示信
息,删除package等功能。老版本的python某些python模块中只有easy_install的安装方式。

EGG

经常接触Python的同学可能会注意到,当需要安装第三方python包时,可能会用到easy_install命令。easy_install是由PEAK(Python Enterprise Application Kit)开发的setuptools包里带的一个命令,它用来安装egg包。egg包是目前最流行的python应用打包部署方式。

https://segmentfault.com/a/1190000007031057

freeze requirement

freeze和部署

pip freeze >requirements.txt
pip install -r C:\Users\Administrator\requirements.txt 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值