在本地安装python软件包进行开发的最佳方法 [英] Best way to install python packages locally for development

查看:81
本文介绍了在本地安装python软件包进行开发的最佳方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是python游戏的新手,我似乎错过了一些关于如何在程序上进行开发以及如何将其保存在实际环境中的知识.

Being new to the python games I seem to have missed out on some knowledge on how you can develop on a program but also keep it in your live environment.

像gpodder这样的程序可以直接从源检出处运行,这确实很方便,但是其他人希望安装"来运行.

Programs like gpodder can be run directly from the source checkout which is really handy however others want to be "installed" to run.

许多程序随setup.py一起分发,并带有以root用户身份运行"python ./setup.py install"的说明,这会将东西放置在文件系统中.甚至还有"develop"之类的安装命令,它们似乎满足了我想要的承诺.所以我尝试了:

A lot of programs are distributed with a setup.py with instructions to run "python ./setup.py install" as root which will put stuff somewhere in your file-system. There are even install commands like "develop" which seem to hold the promise of what I want. So I tried:

export PYTHONPATH=/home/alex/python
python ./setup.py develop --install-dir=/home/alex/python

哪个在本地下载了很多东西,并且似乎神奇地确保了我正在黑客攻击的应用程序仍在src树中用完.所以我想我的round回问题是这是开发python代码的正确方法吗?像easy_install和pip这样的因素如何?

Which downloaded a bunch of stuff locally and seems magically ensure the application I'm hacking on is still being run out of the src tree. So I guess my roundabout question is is this the correct way of developing python code? How do things like easy_install and pip factor into this?

所以我尝试了以下操作:

So I tried the following:

 python /usr/share/pyshared/virtualenv.py /home/alex/src/goobook
 cd /home/alex/src/goobook/googbook.git
 /home/alex/src/goobook/bin/python ./setup.py develop

最后将有问题的程序链接到我的〜/bin

And finally linked the program in question to my ~/bin

 cd /home/alex/src/goobook
 linkbin.pl bin/goobook

但是,调用会引发大量额外的震颤,这似乎表明它是错误的:

However invocation throws up a load of extra chatter which seems to imply it's wrong:


17:17 alex@socrates/i686 [goobook] >goobook --help
/home/alex/bin/goobook:5: UserWarning: Module pkg_resources was already imported from        /home/alex/src/goobook/lib/python2.5/site-packages/setuptools-0.6c8-py2.5.egg/pkg_resources.py, but /home/alex/src/goobook/lib/python2.5/site-packages/distribute-0.6.10-py2.5.egg is being added to sys.path
  from pkg_resources import load_entry_point
/home/alex/bin/goobook:5: UserWarning: Module site was already imported from /home/alex/src/goobook/lib/python2.5/site.pyc, but /home/alex/src/goobook/lib/python2.5/site-packages/distribute-0.6.10-py2.5.egg is being added to sys.path
  from pkg_resources import load_entry_point

推荐答案

安装:

http://pypi.python.org/pypi/virtualenv

为您的库设置本地化的虚拟环境,并且:

to set up a localized virtual environment for your libraries, and:

http://pypi.python.org/pypi/setuptools

即"easy_install"以安装新东西.

i.e. "easy_install" to install new things.

这篇关于在本地安装python软件包进行开发的最佳方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆