Python:如何在我的包或存储库中安装包?
我的程序需要几个 python 包的特定版本。我不想要求用户专门安装特定版本,所以我认为最好的解决方案是简单地将包安装在源存储库中,并将其与我的包一起分发。
最简单的方法是什么?
(请详细说明 - 我熟悉 pip 和 easy_install,但它们似乎不这样做,至少默认情况下不这样做)。
My program requires specific versions of several python packages. I don't want to have to require the user to specifically install the specific version, so I feel that the best solution is to simply install the package within the source repository, and to distribute it along with my package.
What is the simplest way to do this?
(Please be detailed - I'm familiar with pip and easy_install, but they don't seem to do this, at least not by default).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
寻找 virtualenv。生活会容易得多。容易多了。基本上,它允许您根据需要创建特定的 python 环境。
Go for virtualenv. Life will be much easier. MUCH easier. Basically, it allows you to create specific python environments as needed.
确实有两种方法可以完成此任务。
我通常使用 buildout (参见 Django 中 Jacob 的帖子: http://jacobian.org /writing/django-apps-with-buildout/) - 并在项目环境中本地安装 django 以上的所有内容,并支持 pydev 和 django。这很容易,因为我的项目使用最新版本的开源软件,而其他项目则使用相同软件包的特定版本。
正如 Charlie 所说,另一种选择是 virtualenv,它的设计就是为了做到这一点。很多人推荐它,我自己从未使用过它,因为我对构建感到满意。
There are indeed two ways to get this done.
I usually use buildout (see a post by Jacob from Django: http://jacobian.org/writing/django-apps-with-buildout/) - and have everything from django up installed locally at the project's environment, with pydev and django support. It's very easy since I have projects that use latest versions of open source software and others that use specific versions of the same packages.
Another alternative is, as Charlie says, the virtualenv,which is designed to do just that. Many people recommend it, I've never used it myself as I'm happy with buildout.