3

我需要在 python 2.7.5 上安装 PyXML,

:~/Desktop/PyXML-0.8.4$ sudo python setup.py install 
running install
running build
running build_py
running build_ext
building '_xmlplus.parsers.pyexpat' extension
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DXML_NS=1 -DXML_DTD=1 -DBYTEORDER=1234 -DXML_CONTEXT_BYTES=1024 -Iextensions/expat/lib -I/usr/include/python2.7 -c extensions/pyexpat.c -o build/temp.linux-x86_64-2.7/extensions/pyexpat.o
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DXML_NS=1 -DXML_DTD=1 -DBYTEORDER=1234 -DXML_CONTEXT_BYTES=1024 -Iextensions/expat/lib -I/usr/include/python2.7 -c extensions/expat/lib/xmlparse.c -o build/temp.linux-x86_64-2.7/extensions/expat/lib/xmlparse.o
extensions/expat/lib/xmlparse.c:75:2: error: #error memmove does not exist on this platform, nor is a substitute available
 #error memmove does not exist on this platform, nor is a substitute available
  ^
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

我该如何解决这个错误?编辑:

~/Desktop/pyhrf-0.2$ sudo apt-get install python2.7-dev
[sudo] password for vahid: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
python2.7-dev is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 21 not upgraded.

编辑2:

sudo apt-get install python-xml
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package python-xml
4

3 回答 3

12

最好的办法是#define HAVE_MEMMOVE 1/usr/include/python2.7/pyconfig.h.

参考:https ://bugs.launchpad.net/ubuntu/+source/python2.7/+bug/1238244/

于 2014-07-27T00:38:00.417 回答
1

以下在 Ubuntu 12.10 上对我有用:

sudo apt-get install pip

sudo pip install PyXML

Downloading/unpacking PyXML
Running setup.py egg_info for package PyXML
于 2014-02-04T13:18:57.230 回答
-1

我认为您需要先安装python2.7-dev

尝试:

sudo apt-get install python2.7-dev

另外,安装python模块时最好使用pip..无论如何试一试。

于 2013-11-06T14:24:58.907 回答