Update your existing virtualenv to use Python 3.6

I have an existing virtualenv called "edge". It uses Python 3.5.2. I have updated my Python interpreter to 3.6 and I want the "edge" env to use 3.6.

What command should I use for the update

edge interpreter?

I've searched SO, but all the answers I can find are for creating a new env. In my case, I don't want to create a new env.

+3


source to share


1 answer


All binary packages installed for python3.5 (like numpy

or simplejson

) are incompatible with python3.6 (they are not compatible with abi). This way you cannot upgrade / downgrade virtualenv to a different python version.

Your best bet would be to create a new virtualenv based on the packages installed in the original virtualenv. You can get closer by doing the following

edge/bin/pip freeze > reqs.txt
virtualenv edge2 -p python3.6
edge2/bin/pip install -r reqs.txt

      



Note that virtualenvs do not usually move around, so if you want it to exist in edge

you will most likely need the following procedure

edge/bin/pip freeze > reqs.txt
mv edge edge_old
virtualenv edge -p python3.6
edge/bin/pip install -r reqs.txt
# optionally: rm -rf edge_old

      

+3


source







All Articles