如何修复PyXML?

2 投票
2 回答
2417 浏览
提问于 2025-04-16 09:49

我有一组用Python写的脚本,这些脚本使用了PyXML这个库。之前这些脚本运行得很好,但现在出现了错误。

我该如何修复这个问题呢?

$ script.py
Traceback (most recent call last):
  File "/cygdrive/c/mypath/script.py", line 16, in <module>
    from xml import xpath
  File "/cygdrive/c/data/code/xml/PyXML-0.8.4/xml/xpath/__init__.py", line 105, in <module>
    import Context
  File "/cygdrive/c/data/code/xml/PyXML-0.8.4/xml/xpath/Context.py", line 15, in <module>
    import CoreFunctions
  File "/cygdrive/c/data/code/xml/PyXML-0.8.4/xml/xpath/CoreFunctions.py", line 20, in <module>
    from xml.xpath import Util, Conversions
  File "/cygdrive/c/data/code/xml/PyXML-0.8.4/xml/xpath/Conversions.py", line 22, in <module>
    from xml.utils import boolean
ImportError: cannot import name boolean

然后我尝试重新安装PyXML,但这次安装失败了。

$ easy_install PyXML
Searching for PyXML
Reading http://pypi.python.org/simple/PyXML/
Reading http://www.python.org/sigs/xml-sig/
Best match: PyXML 0.8.4
Downloading http://downloads.sourceforge.net/pyxml/PyXML-0.8.4.tar.gz?modtime=1101741917&big_mirror=0
Processing PyXML-0.8.4.tar.gz
Running PyXML-0.8.4/setup.py -q bdist_egg --dist-dir /tmp/easy_install-ZIX2LS/PyXML-0.8.4/egg-dist-tmp-5x8fiU
warning: no files found matching '*.html' under directory 'extensions/expat'
warning: no files found matching '*Makefile' under directory 'extensions/expat'
warning: no files found matching '*.dsp' under directory 'extensions/expat'
warning: no previously-included files matching '*/CVS/*' found anywhere in distribution
     69 [main] python 3116 C:\cygwin\bin\python.exe: *** fatal error - unable to remap C:\cygwin\bin\cygcrypto-0.9.8.dll to same address as parent: 0x600000 != 0x910000
Stack trace:
Frame     Function  Args
00285F18  6102749B  (00285F18, 00000000, 00000000, 00000000)
00286208  6102749B  (61177B80, 00008000, 00000000, 61179977)
00287238  61004AFB  (611A136C, 6124060C, 00600000, 00910000)
End of stack trace
      2 [main] python 6800 fork: child 3116 - died waiting for dll loading, errno 11
error: Setup script exited with error: Resource temporarily unavailable

2 个回答

0

虽然我提供了另一个解决方案,但看起来你在使用一个不稳定的cygwin,我觉得真正的问题出在这里,而不是在PyXML包上。

你可以尝试重新安装cygwin,或者:尝试从这里用Windows安装程序安装Pyxml。

1

我不知道这是否能解决你具体的问题,但我遇到过类似的问题,后来在网上搜索时找到了这里。对于那些从谷歌过来的人,这个问题是出在pip安装上,解决方法是:

你需要先安装它。你应该在网上找到文件PyXML-0.8.4.tar.gz,然后运行:

pip install the PyXML tarball

撰写回答