简体   繁体   English

同一脚本的不同版本以及同一python安装上的软件包

[英]Different versions of the same script with packages on the same python installation

I have a script, which contains some packages/modules. 我有一个脚本,其中包含一些软件包/模块。 Now, the development and the production environment run on the same server on the same python installation (version 2.6). 现在,开发和生产环境在同一python安装(版本2.6)上的同一服务器上运行。 What is the best way to manage my script so that it would be easy to change the development or the production version of the script (eg install latest trunk to dev or install stable version to production)? 什么是管理脚本的最佳方法,以便可以轻松更改脚本的开发或生产版本(例如,将最新的主干安装到开发人员或将稳定的版本安装到生产中)?

There is one related question/answer: Using different versions of a python library in the same process But I'd like to know, is there a more standard way for this than renaming libA to libA_dev etc. 有一个相关的问题/答案: 在同一过程中使用不同版本的python库,但我想知道,除了将libA重命名为libA_dev等之外,还有一种更标准的方法吗?

For example, I could have configuration file for both environments. 例如,我可能有两种环境的配置文件。 The path of the libs is specified (libA, libA_dev). 指定了lib的路径(libA,libA_dev)。 I could have 2 different setup scripts (or make on configurable) which indicate, where to install packages. 我可以有2个不同的安装脚本(或使它们可配置),指示安装包的位置。 And now my executable should read the configuration (from the working path) and import only packages from specified path. 现在,我的可执行文件应该从工作路径中读取配置,并且仅从指定路径中导入软件包。 I don't know, whether it is doable? 我不知道这是否可行? And is it the "standard" way for this? 这是“标准”方式吗?

Your question is not totally clear to me. 您的问题对我来说并不完全清楚。

Do you want to deploy different branches of your application to your development and productions servers? 您是否要将应用程序的不同分支部署到开发和生产服务器? It's a version control/deployment question then. 那是一个版本控制/部署问题。

On the other hand, if you want to install the package (ie your application) into different Python "environments" (eg One with ver1 of the dependent libraries and the other ver 2), they the tool of choice is virtualenv . 另一方面,如果您要将软件包(即您的应用程序)安装到不同的Python“环境”中(例如,一个具有Ver1的从属库,另一个则具有2),则选择的工具是virtualenv

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM