gpt4 book ai didi

python lxml 3.3.5 - 加载代码时出错 - "ValueError: lxml.etree._Element has the wrong size, try recompiling"

转载 作者:数据小太阳 更新时间:2023-10-29 02:40:38 27 4
gpt4 key购买 nike

我通过 pip 安装了 lxml 3.3.5。现在我在运行一些 Django 测试时遇到了问题:

Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/vagrant/venv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 399, in execute_from_command_line
utility.execute()
File "/home/vagrant/venv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/vagrant/venv/local/lib/python2.7/site-packages/django/core/management/commands/test.py", line 50, in run_from_argv
super(Command, self).run_from_argv(argv)
File "/home/vagrant/venv/local/lib/python2.7/site-packages/django/core/management/base.py", line 242, in run_from_argv
self.execute(*args, **options.__dict__)
File "/home/vagrant/venv/local/lib/python2.7/site-packages/django/core/management/commands/test.py", line 71, in execute
super(Command, self).execute(*args, **options)
File "/home/vagrant/venv/local/lib/python2.7/site-packages/django/core/management/base.py", line 285, in execute
output = self.handle(*args, **options)
File "/home/vagrant/venv/local/lib/python2.7/site-packages/south/management/commands/test.py", line 8, in handle
super(Command, self).handle(*args, **kwargs)
File "/home/vagrant/venv/local/lib/python2.7/site-packages/django/core/management/commands/test.py", line 88, in handle
failures = test_runner.run_tests(test_labels)
File "/home/vagrant/venv/local/lib/python2.7/site-packages/django/test/runner.py", line 144, in run_tests
suite = self.build_suite(test_labels, extra_tests)
File "/home/vagrant/venv/local/lib/python2.7/site-packages/django/test/runner.py", line 63, in build_suite
tests = self.test_loader.loadTestsFromName(label)
File "/usr/lib/python2.7/unittest/loader.py", line 91, in loadTestsFromName
module = __import__('.'.join(parts_copy))
File "/vagrant/myapp/tests/test_myapp.py", line 12, in <module>
import dm.xmlsec.binding as xmlsec
File "/home/vagrant/venv/local/lib/python2.7/site-packages/dm/xmlsec/binding/__init__.py", line 2, in <module>
from _xmlsec import *
File "etreepublic.pxd", line 33, in init dm.xmlsec.binding._xmlsec (src/_xmlsec.c:9587)
ValueError: lxml.etree._Element has the wrong size, try recompiling

如回溯所示,加载代码时失败。如果我尝试从 python shell 导入,第一次失败:

In [1]: import dm.xmlsec.binding as xmlsec
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-1-74e93bb8b8dd> in <module>()
----> 1 import dm.xmlsec.binding as xmlsec

/home/vagrant/venv/local/lib/python2.7/site-packages/dm/xmlsec/binding/__init__.py in <module>()
1 # Copyright (C) 2012 by Dr. Dieter Maurer <dieter@handshake.de>; see 'LICENSE.txt' for details
----> 2 from _xmlsec import *
3
4 def dsig(tag):
5 """`lxml` tag designator for *tag* in DSig namespace."""

/vagrant/etreepublic.pxd in init dm.xmlsec.binding._xmlsec (src/_xmlsec.c:9587)()

ValueError: lxml.etree._Element has the wrong size, try recompiling

In [2]: import dm.xmlsec.binding as xmlsec

有什么帮助吗?

最佳答案

尝试运行这个:

pip install -I --no-cache lxml==3.3.5
pip uninstall -y dm.xmlsec.binding
pip install --no-cache dm.xmlsec.binding

dm.xmlsec.bindinglxml 之前安装或者 lxml 发生变化时,我遇到了问题。

关于python lxml 3.3.5 - 加载代码时出错 - "ValueError: lxml.etree._Element has the wrong size, try recompiling",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24310242/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com