Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Specify Python Version for Virtualenv in Requirements.txt

Tags:

I'm using virtualenv to develop a django application with a team. The server we're deploying on is running python 2.6, but the default for our machines is 2.7.3. Is there any way to specify python version in the requirements.txt file, or something similar, within the code base?

I know requirements.txt is a pip thing, and python version is a virtualenv thing, but it would be really convenient not to have to tell every new person joining the team how to set up their virtualenv.

like image 814
Arion Avatar asked Aug 09 '12 18:08

Arion


1 Answers

Neither pip nor virtualenv install python (though pip tries). They use whatever you specify.

You could write a README that mentions required Python version or provide a fabric script that can deploy to localhost and specify the version there. For example, instructions to install virtualenv, pip, distribute.

For those people who don't read instructions there could be a CI system (jenkins, buildbot) that can run unit-tests using supported python versions (before/after commit).

To manage multiple python installation you could use something like pythonz.

like image 118
jfs Avatar answered Nov 05 '22 19:11

jfs