I have an existing virtualenv called 'edge'. It uses Python 3.5.2. I have upgrade my Python interpreter to 3.6 and I want the 'edge` env to use 3.6 instead.
What command should I used to update
edge's interpreter?
I searched on 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.
All binary packages installed for python3.5 (for example numpy
or simplejson
) are not compatible with python3.6 (they are not abi compatible). As such, you can't upgrade / downgrade a virtualenv to a different version of python.
Your best bet would be to create a new virtualenv based on the packages installed in the original virtualenv. You can get close 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 generally aren't movable, so if you want it to exist at edge
you'll probably want the following procedure instead
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With