• Uncategorized

About python : How-to-change-the-python-version-that-a-virtual-environment-uses-in-Ubuntu-1404-duplicate

Question Detail

I am having trouble because I have an existing django project app which I am currently working under a virtual environment. However, the python version for that environment is 2.7. I need to somehow switch that to python3.4 if at all possible. I realize there’s the possibility of just creating a new environment, but I don’t know how to create a new one with existing django files and a new python version. Anyone know what I should/could do?

Question Answer

Activate your old Python 2.7 enviroment:

source /path/to/your/env/bin/activate

Save dependencies:

pip freeze > env.txt

Create new Python 3.x enviroment:

virtualenv -p python3 newenvname

Activate new environment and install all dependencies from the old environment from env.txt:

source newenv/bin/activate
pip install -r env.txt

You may also like...

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.