2

Using Python I require both python 2.7 and python 3.5 for different packages. I am trying to install the following package NepidemiX. I get an error when I do this as I have a newer version of python installed.

To combat this I am trying to create a virtual environment. To do this I am using the virtualenv package.

I have created and activated this and am now faced with

(my_project)Your-Computer:your_project UserName$) 

In my terminal.

How do I now proceed to install my package from here? Do I need to install python 2.7 in this environment first, or do I simply copy the desired package into the environment ... ?

Please could you instruct me how to correctly set this up? Many thanks!

1
  • You can only create a virtualenv of the Python installation version that made it, by the way. Commented Apr 24, 2017 at 13:31

1 Answer 1

2

Virtual environment is only for libraries. It uses python versions installed on your computer. You can specify the version of python by using the -p attribute while creating the environment, for ex. virtualenv -p python3 env creates a python 3 enviroment (provided you have it installed in your computer and on the PATH). Check this answer. After you activate the environment (source /env/bin/activate), just pip install libraries, and the environment takes care of installing the correct version.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.