Standard python libraries not importing error in Virtualenv
If you just updated your system and working with some python application in virtualenv, it is possible to get some weird error with standard libraries import like:
ImportError: No module named datetime
Probably some of your python global installations files has changed, so Virtualenv has some broken links.
Solution:
- From inside your virtualenv, save all the required libraries to a requirements file:
pip freeze > requirements.txt
- Delete your virtualenv :
rmvirtualenv your_virtualenv_name
-Then create it again with virtualenv wrapper:
mkvirtualenv your_virtualenv_name
- From inside your virtualenv, reinstall all your application requierements:
pip install -r requirements.txt
You got it!
Written by Pablo Bernardo
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Python
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#