我已经在centos机器上安装了python-ldap
和{
当我尝试导入ldap时,python2.x效果很好。但在python3.4版本中,它返回以下异常:
ImportError: No module named 'ldap'
在python3.4版本中使用ldap还需要安装其他库吗?在
任何帮助都将不胜感激。在
谢谢。在
编辑:
我尝试通过以下命令在python 3.4版本中安装库:
^{pr2}$但我有以下例外:
Command "/usr/bin/python3.4 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-qvn41t9w/python-ldap/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-zev4yfdk/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-qvn41t9w/python-ldap/
您必须为要使用的每个python版本分别安装一个模块。如果将其安装在python2.7上,则不会安装在python3.6上。即使在3.6上安装了它,也不会在3.7上安装。您必须为每个python版本分别安装该模块。在
阅读this tutorial on pip troubleshooting和{a2}可能有帮助。在
相关问题 更多 >
编程相关推荐