django_auth_ldap no module named ldap

落爺英雄遲暮 提交于 2019-12-23 07:46:03

问题


I am trying to get the django_auth_module working but I don't think I managed to install it properly.

I downloaded the package and ran setup.py install. Then in my settings.py file I tried to import the module ldap and it gave me the following error :

ImportError: no module named ldap

I am working on a CentOS 6 server.

Maybe it has to do with where I should install the module? The folder is in the directory just above my site folder, but maybe that's wrong...

RESOLVED : Ok, I just needed to install the module python-ldap... problem solved!


回答1:


Install missing module

Hint: To install python-ldap with pip on Ubuntu, some libraries are needed. Use the apt-get commands to install them.

Python 2

sudo apt-get install python-dev libldap2-dev libsasl2-dev libssl-dev
sudo pip install python-ldap

Python 3

sudo apt-get install libsasl2-dev python-dev libldap2-dev libssl-dev
sudo pip3 install pyldap



回答2:


Try the below command to install for Python3.

sudo apt-get install libsasl2-dev python-dev libldap2-dev libssl-dev
sudo pip3 install pyldap


来源:https://stackoverflow.com/questions/6857680/django-auth-ldap-no-module-named-ldap

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!