edesz
edesz

Reputation: 12406

Python virtualenv - multiple versions of Python and multiple versions of Python packages per version

I am looking to set up Python's virtualenv. I am doing this since I need to run some python files written with:

a. Python 2.7 and also need to run some files that were written for python 3.4

b. two different versions of:

I need to run all these files on the same Windows system (Windows 7 64-bit).

Currently:

I currently have Python 2.7 installed with NumPy 1.9.3 and Matplotlib 1.5.0. I have set up and used virtualenv using the following procedure:

cd C:\Users\WrAU\Downloads
virtualenv venv_test
cd venv_test
venv_test\Scripts\activate
pip install Django==1.0
deactivate

I have added C:\Python27 and C:\Python27\Scripts to my path. I have not yet installed Python 3.4.

My problem:

I need:

Questions:

Do I need to create a separate virtualenv for Python 3.4 using the same procedure as I did for Python 2.7 above? Or is there a different method that is required for that?

How do I install separate versions of Python packages to a virtualenv?

Upvotes: 0

Views: 1633

Answers (2)

fernandezcuesta
fernandezcuesta

Reputation: 2448

Under windows I would definitely do it through anaconda/miniconda. Regardless of which version (py3/py2) you install, it can create venvs for py3/py2. For example:

conda create -n app_py2 numpy==1.9.3 matplotlib==1.5.0 python=2
conda create -n app_py2 numpy==1.10.0 matplotlib==1.4.1 python=3

Upvotes: 1

Herve
Herve

Reputation: 127

Yes you do create 1 virtualenv per interpreter. In it you can install matplotlib and numpy. You can create 2 venv with python 2.7 for testing differents versions of matplotlib and numpy, and make the same scheme with python 3.X

Upvotes: 1

Related Questions