I had a long-working virtualenv based on python-2.7.3. After accepting recommended platform OS (Ubuntu) updates which (among many other changes) brought python up to 2.7.6, the python inside the virtualenv has started erroring on essentially all non-trivial tasks, with stacks ending like:
ImportError: /home/myusername/ENVS/myvenv/lib/python2.7/lib-dynload/_io.so: undefined symbol: _PyLong_AsInt
Even pip freeze
is failing with such an error -- making it impossible to even get an accurate inventory of installed packages in the broken virtualenv (for potentially reinstalling into a fresh working virtualenv)!
Shouldn't the virtualenv be protected from such outside upgrades? Or at least within the 2.7.x series?
You can't upgrade to a Python version you don't already have on your system somewhere, so make sure to get the version you want, first, then make all the venvs you want from it. Save this answer. Show activity on this post.
There is no command for deleting your virtual environment. Simply deactivate it and rid your application of its artifacts by recursively removing it. Note that this is the same regardless of what kind of virtual environment you are using.
You can simply do
cp /usr/bin/python2 /path/to/my-virtualenv/bin/python2
or
cp /usr/bin/python3 /path/to/my-virtualenv/bin/python3
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