1

I have a python script that makes use of various third-party and in-house libraries.

The problem is, they require different versions of Python.

My method to solve is going to be; have a folder containing the older version of python that I need, inside the project root folder. Run the main script using the most recent version of python; when I need to call on functions and modules that only work with an older version of python, use subprocess.call() to call the older python interpreter and pass to it the second script I want to run.

My question is: is this the right way to solve the problem? Is there a neater way? I'm getting a vague feeling that I shouldn't be doing this.

Richard
  • 494
  • 7
  • 18
  • Sounds messy. I'm guessing updating the libraries to be compatible with one version is not an option? – kylieCatt May 20 '15 at 16:42
  • You can look at using virtualenv Checkout: http://stackoverflow.com/questions/1534210/use-different-python-version-with-virtualenv – Anand Davis May 20 '15 at 16:43
  • 1
    [pyenv](https://github.com/yyuu/pyenv) is another option – Joshua Grigonis May 20 '15 at 16:43
  • have you considered migrating everything to python 3, as that seems to be the future of the language. there are good tools (2to3, six, ...) that aim to make this process as painless as possible. – Haleemur Ali May 20 '15 at 17:04
  • I've flagged this to be removed as basically an opinion question, but I encourage you to start a new question - this time, bring in some specifics so you can get proper answers. – Jon Kiparsky May 20 '15 at 17:06
  • @Richard That's a horrible idea. Do not do that… clean everything up and migrate. You'll not regret it. – tamasgal May 20 '15 at 17:11

0 Answers0