Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't install python-ldap via pip

I can't install python-ldap via pip, I get the following error:

$ sudo pip3.4 install python-ldap
Downloading/unpacking python-ldap
  Downloading python-ldap-2.4.19.tar.gz (138kB): 138kB downloaded
  Running setup.py (path:/tmp/pip_build_root/python-ldap/setup.py) egg_info for package python-ldap
    Traceback (most recent call last):
      File "<string>", line 17, in <module>
      File "/tmp/pip_build_root/python-ldap/setup.py", line 53
        print name + ': ' + cfg.get('_ldap', name)
                 ^
    SyntaxError: invalid syntax
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

  File "<string>", line 17, in <module>

  File "/tmp/pip_build_root/python-ldap/setup.py", line 53

    print name + ': ' + cfg.get('_ldap', name)

             ^

SyntaxError: invalid syntax

----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /tmp/pip_build_root/python-ldap
Storing debug log for failure in /home/nima/.pip/pip.log

Any ideas how to resolve this?

like image 264
Nima G Avatar asked Apr 11 '15 21:04

Nima G


2 Answers

It seems that your python-ldap is implemented in Python-2.X but you're using Python-3.X (Print Is A Function in python 3). Therefore, you need to install a newer version of this library that supports Python-3.X or install the library in python-2.X which is not recommended.

You can install the proper version for Python-3.X though using following command:

# if pip3 is the default pip alias for python-3
pip3 install python3-ldap

# otherwise 
pip install python3-ldap

Also here is the link of PiPy package for further information. https://pypi.python.org/pypi/python3-ldap/0.9.8.4/

like image 81
Mazdak Avatar answered Nov 13 '22 06:11

Mazdak


You can install python-ldap which is implemented for python3

pip install python3-ldap
like image 29
Ravi garg Avatar answered Nov 13 '22 06:11

Ravi garg