[英]How to install python package without copy everything into lib/site-packages?
I want to develop a common python package, I got other packages depends on it. 我想开发一个通用的python包,我得到了其他依赖于它的包。 For example: 例如:
packageA, packageB and packageC can all be executed directly, but they are all depend on commonPackage. packageA,packageB和packageC都可以直接执行,但是它们都依赖于commonPackage。 I want to install the commonPackage into lib/site-packages, but I don't want it copys the source code. 我想将commonPackage安装到lib / site-packages中,但是我不希望它复制源代码。 Instead, I want it creates a commonPackage.pth in lib/site-packages with the path of where the commonPackage at. 相反,我希望它在lib / site-packages中使用commonPackage所在的路径创建一个commonPackage.pth。 So that when I modify commonPackage or update it from SVN, I don't need to install it again. 这样,当我修改commonPackage或从SVN更新它时,就无需再次安装它。 Here comes the problem, how can I write the setup.py or use the options of python setup.py install so that it would do what I want? 问题来了,我该如何编写setup.py或使用python setup.py install的选项来执行我想要的工作?
You can always take a look at virtualenv which will allow you to create a python environment for each of your projects - this is the ideal way to develop/build/deploy your app without having load up your site-packages directory with all and sundry. 您可以随时查看virtualenv,它允许您为每个项目创建一个python环境-这是开发/构建/部署应用程序的理想方法,而无需加载所有内容和杂项的site-packages目录。
There's a good tutorial here: 这里有一个很好的教程:
http://iamzed.com/2009/05/07/a-primer-on-virtualenv/ http://iamzed.com/2009/05/07/a-primer-on-virtualenv/
Good luck ! 祝好运 !
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.