Importerror: no module named memcache (Django project)

In my Django project, I run this command to run the project on localhost:

python manage.py runserver

This results in an error:

Importerror: No module named memcache

However, I have already fulfilled this requirement with: sudo apt-get install python-memcache

In particular, if I go into the python shell outside my virtualevn and try import memcache , it works fine. However, inside my virtualenv, if I go into the python shell and try import memcache , I get the same import error as above. What's happening?

+9
source share
2 answers

Since you are using virtualenv , you will need to install this dependency from within, since you could create a virtual environment before installing it as a system-wide library.

From inside your virtualenv type:

 pip install python-memcached 

That should decide.

+25
source

First run

 pip install django-pylibmc 

install cache memory:

 CACHES = { 'default': { 'BACKEND': 'django.core.cache.backends.memcached.PyLibMCCache', 'LOCATION': '127.0.0.1.11211', } } 
0
source

Source: https://habr.com/ru/post/1013951/


All Articles