如何创建 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
或者,如果您感觉很奇特(阅读:懒惰)...
sudo easy_install PasteScript
paster create mynewpackage
cd mynewpackage
python setup.py sdist
python setup.py register
看起来步骤更多,但是 PasteScript 包处理了很多脏活。帮自己一个忙,安装它,使用它,永远不要回头;)
Or, if you're feeling fancy (read: lazy)...
sudo easy_install PasteScript
paster create mynewpackage
cd mynewpackage
python setup.py sdist
python setup.py register
Seems like more steps, but the PasteScript package handles a lot of the dirty work. Do yourself a favor and install it, use it, and never look back ;)
您需要
您可以使用以下方式注册:
exmaple setup.py 文件是:
用户只需解压 taz 文件并运行 install..
You need to
You can register using:
An exmaple setup.py file is:
Users will then just have to upack the taz file and run install..
我希望
PasteScript
能够完成这项工作,因为它看起来很简单,但它对我来说根本不起作用。我使用 Peter Down 的 快速但解释清楚的教程。另外,请记住,如果您尝试从包中
导入
代码,则必须将其放入__init__.py
中,这对于大多数项目来说已经足够了。I wish
PasteScript
did the job because it seems straightforward but it simply didn't work for me. I got my code uploaded to thepip
repository with Peter Down's quick but well-explained tutorial.Also, remember that if you are trying to have your code
import
from the package, you have to put it in__init__.py
, which is sufficient for most projects.您可能想查看 libmaker。它使制作包变得容易。 此是主页和文档的链接。
You may want to check out libmaker. It makes it easy to make packages. This is the link to the homepage and documentation.