Tuesday, May 28, 2013

Upgrade to Ubuntu 13.04 - Fix ImportError in Virtualenv

1. The ImportError: cannot import name MAXREPEAT appears inside a virtualenv environment when I run the command python manage.py runserver, after I upgraded my Ubuntu from 12.10 to 13.04. The problem was that Ubuntu 13.04 use python 2.7.4. That makes conflict with the Python version of thevirtualenv

It can be fixed easily by entering the following command:

cp /usr/bin/python /path/to/my/env/bin/




2. ImportError: No module named _sysconfigdata_nd
appears when create a new virtualenv environment: $ virtualenv /.venv/new_env

Fix by create a softlink of module _sysconfigdata_nd.py in python2.7 dir:


cd /usr/lib/python2.7
sudo ln -s plat-x86_64-linux-gnu/_sysconfigdata_nd.py .