I am trying to install pyldap to use it with django-auth-ldap but when doing:
pip install pyldap
I get:
In file included from Modules/LDAPObject.c:4:0:
Modules/common.h:10:20: fatal error: Python.h: No such file or directory
#include "Python.h"
^
compilation terminated.
error: command 'gcc' failed with exit status 1
Important
I am using Virtualenv, witch was created in python3:
virtualenv -p python3 myvirtualenv
And I have already installed the development packages (I am in CentOS, found in this answer) :
sudo yum install python-devel
sudo yum install openldap-devel
What I already tried
Create two new virtualenv:
- One with python 3.4 (using the command above) and the
pip install pyldap
doesn't work (with the error described above) - One with python 2.7 (using the command above without
-p python3
)and thepip install pyldap
works Install the package as root
sudo pip3 install pyldap
and it works but when I run in the django app in the virtualenv I get:import ldap ImportError: No module named 'ldap'
I pretend to use pyldap precisely because it supports python3 so I can't understand why this happens and how may I resolve it. If you can't answer this question directly but you know other library I may use for Active Directory authentication in Django please comment this question.