我python-ldap
在我的Django
应用程序中使用,并且一直运行良好。我目前正在升级我的项目中的许多部门,以期在 alpine 和 docker 上使用最新的 django。
尝试执行./manage shell
(或任何其他管理命令)突然开始给我这个错误;
...
File "/usr/lib/python2.7/site-packages/ldap/__init__.py", line 22, in <module>
import _ldap
ImportError: Error relocating /usr/lib/python2.7/site-packages/_ldap.so: ber_free: symbol not found
python -c 'import _ldap'
工作正常,./manage.py shell -c 'import _ldap'
出现上述错误。
摆弄,我注意到如果我import ldap
很早,错误就消失了。
经过长时间的编辑和调试,我发现如果我在https://github.com/django/django/blob/1.10/django/apps/config.py#L107if entry == 'django.contrib.postgres': import ldap
之前添加,django 就可以.
在 L107 上是(https://github.com/django/django/blob/1.10/django/contrib/postgres/apps.py#L10)。import ldap
module.default_app_config
django.contrib.postgres.apps.PostgresConfig
很明显,postgres import 正在做一些事情。但是它用 ldap 做什么呢?某处是否存在名称冲突?如何进一步调试?
我不想要“只在你的上面导入 ldap”的解决方案settings.py
。这是一个错误,应该修复。
- 姜戈:1.10
- 高山:3.4
- 蟒蛇:2.7.12
- psycopg2:2.6.2
- libpq:9.5.3-r1