After upgraded Python 2.7 to latest version, it may occur to _PyErr_ReplaceException sometimes in virtualenv created by former version of python. For example:
>>> import io
Traceback (most recent call last):
File "", line 1, in
File "/usr/lib/python2.7/io.py", line 51, in
import _io
ImportError: /home/ubuntu/ikaka/leanStudy/venv/lib/python2.7/lib-dynload/_io.so: undefined symbol: _PyErr_ReplaceException
This is because the virtualenv had copied the python executable binary but linked lib directory. So just replace the python executable binary in virtualenv with the one in /usr/lib, like
cp /usr/bin/python /bin/python
Comments