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). 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.
For example, I could have configuration file for both environments. The path of the libs is specified (libA, libA_dev). I could have 2 different setup scripts (or make on configurable) which indicate, where to install packages. And now my executable should read the configuration (from the working p开发者_开发技巧ath) 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 (i.e. your application) into different Python "environments" (e.g. One with ver1 of the dependent libraries and the other ver 2), they the tool of choice is virtualenv.
精彩评论