如何创建pip可安装项目? [英] How do I create a pip installable project?
本文介绍了如何创建pip可安装项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何创建可安装pip的项目?您如何在pip上注册?
How do I create a pip installable project? How do you register with pip?
所有项目应具有什么样的元数据配置,以允许集成和轻松导入.
What meta data config should all projects have in order to allow integration and easy import.
推荐答案
您需要
- 写一个setup.py文件
- 运行python setup.py sdist tar gzip压缩文件.
- 使用网络表单运行注册或提交项目.
您可以使用以下方式注册:
You can register using:
>> python setup.py register
一个示例setup.py文件是:
An exmaple setup.py file is:
#!/usr/bin/env python
from distutils.core import setup
setup(name='Distutils',
version='1.0',
description='Python Distribution Utilities',
author='Greg Ward',
author_email='gward@python.net',
url='http://www.python.org/sigs/distutils-sig/',
packages=['distutils', 'distutils.command'],
)
然后,用户将只需要打包taz文件并运行install ..
Users will then just have to upack the taz file and run install..
>> python setup.py install
这篇关于如何创建pip可安装项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文