Ubuntu 13.04 安装 Python PIP 时出现错误

Ubuntu 13.04 安装 Python PIP 时出现错误

尝试使用 Ubuntu 13.04 而不是 Ubuntu 12.10 来运行我的 Chef 食谱后,我在尝试运行sudo pip install cElementTree supervisor

STDOUT: Downloading/unpacking cElementTree
  Running setup.py egg_info for package cElementTree

Downloading/unpacking supervisor
  Running setup.py egg_info for package supervisor

Requirement already satisfied (use --upgrade to upgrade): distribute in /usr/local/lib/python2.7/dist-packages/distribute-0.6.45-py2.7.egg (from supervisor)
Downloading/unpacking meld3>=0.6.5 (from supervisor)
  Running setup.py egg_info for package meld3

Installing collected packages: cElementTree, supervisor, meld3
  Running setup.py install for cElementTree
    building 'cElementTree' extension
    x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DXML_STATIC -DXML_NS=1 -DXML_DTD=1 -DBYTEORDER=1234 -DXML_CONTEXT_BYTES=1024 -Iexpat -I/usr/include/python2.7 -c cElementTree.c -o build/temp.linux-x86_64-2.7/cElementTree.o
    cElementTree.c:1368:5: warning: initialization from incompatible pointer type [enabled by default]
    cElementTree.c:1368:5: warning: (near initialization for 'element_as_sequence.sq_length') [enabled by default]
    cElementTree.c:1371:5: warning: 'intargfunc' is deprecated [-Wdeprecated-declarations]
    cElementTree.c:1371:5: warning: initialization from incompatible pointer type [enabled by default]
    cElementTree.c:1371:5: warning: (near initialization for 'element_as_sequence.sq_item') [enabled by default]
    cElementTree.c:1372:5: warning: 'intintargfunc' is deprecated [-Wdeprecated-declarations]
    cElementTree.c:1372:5: warning: initialization from incompatible pointer type [enabled by default]
    cElementTree.c:1372:5: warning: (near initialization for 'element_as_sequence.sq_slice') [enabled by default]
    cElementTree.c:1373:5: warning: initialization from incompatible pointer type [enabled by default]
    cElementTree.c:1373:5: warning: (near initialization for 'element_as_sequence.sq_ass_item') [enabled by default]
    cElementTree.c:1374:5: warning: initialization from incompatible pointer type [enabled by default]
    cElementTree.c:1374:5: warning: (near initialization for 'element_as_sequence.sq_ass_slice') [enabled by default]
    cElementTree.c: In function 'expat_unknown_encoding_handler':
    cElementTree.c:2143:5: warning: pointer targets in passing argument 1 of 'PyUnicodeUCS4_Decode' differ in signedness [-Wpointer-sign]
    In file included from /usr/include/python2.7/Python.h:85:0,
                     from cElementTree.c:44:
    /usr/include/python2.7/unicodeobject.h:685:23: note: expected 'const char *' but argument is of type 'unsigned char *'
    cElementTree.c: In function 'xmlparser':
    cElementTree.c:2181:38: warning: passing argument 4 of 'PyArg_ParseTupleAndKeywords' from incompatible pointer type [enabled by default]
    In file included from /usr/include/python2.7/Python.h:126:0,
                     from cElementTree.c:44:
    /usr/include/python2.7/modsupport.h:28:17: note: expected 'char **' but argument is of type 'const char **'
    cElementTree.c: In function 'initcElementTree':
    cElementTree.c:2573:15: warning: variable 'm' set but not used [-Wunused-but-set-variable]
    x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DXML_STATIC -DXML_NS=1 -DXML_DTD=1 -DBYTEORDER=1234 -DXML_CONTEXT_BYTES=1024 -Iexpat -I/usr/include/python2.7 -c expat/xmlparse.c -o build/temp.linux-x86_64-2.7/expat/xmlparse.o
    expat/xmlparse.c:75:2: error: #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
    Complete output from command /usr/bin/python -c "import setuptools;__file__='/tmp/pip-build-root/cElementTree/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-cPAsJo-record/install-record.txt --single-version-externally-managed:
    running install

running build

running build_ext

building 'cElementTree' extension

x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DXML_STATIC -DXML_NS=1 -DXML_DTD=1 -DBYTEORDER=1234 -DXML_CONTEXT_BYTES=1024 -Iexpat -I/usr/include/python2.7 -c cElementTree.c -o build/temp.linux-x86_64-2.7/cElementTree.o

cElementTree.c:1368:5: warning: initialization from incompatible pointer type [enabled by default]

cElementTree.c:1368:5: warning: (near initialization for 'element_as_sequence.sq_length') [enabled by default]

cElementTree.c:1371:5: warning: 'intargfunc' is deprecated [-Wdeprecated-declarations]

cElementTree.c:1371:5: warning: initialization from incompatible pointer type [enabled by default]

cElementTree.c:1371:5: warning: (near initialization for 'element_as_sequence.sq_item') [enabled by default]

cElementTree.c:1372:5: warning: 'intintargfunc' is deprecated [-Wdeprecated-declarations]

cElementTree.c:1372:5: warning: initialization from incompatible pointer type [enabled by default]

cElementTree.c:1372:5: warning: (near initialization for 'element_as_sequence.sq_slice') [enabled by default]

cElementTree.c:1373:5: warning: initialization from incompatible pointer type [enabled by default]

cElementTree.c:1373:5: warning: (near initialization for 'element_as_sequence.sq_ass_item') [enabled by default]

cElementTree.c:1374:5: warning: initialization from incompatible pointer type [enabled by default]

cElementTree.c:1374:5: warning: (near initialization for 'element_as_sequence.sq_ass_slice') [enabled by default]

cElementTree.c: In function 'expat_unknown_encoding_handler':

cElementTree.c:2143:5: warning: pointer targets in passing argument 1 of 'PyUnicodeUCS4_Decode' differ in signedness [-Wpointer-sign]

In file included from /usr/include/python2.7/Python.h:85:0,

                 from cElementTree.c:44:

/usr/include/python2.7/unicodeobject.h:685:23: note: expected 'const char *' but argument is of type 'unsigned char *'

cElementTree.c: In function 'xmlparser':

cElementTree.c:2181:38: warning: passing argument 4 of 'PyArg_ParseTupleAndKeywords' from incompatible pointer type [enabled by default]

In file included from /usr/include/python2.7/Python.h:126:0,

                 from cElementTree.c:44:

/usr/include/python2.7/modsupport.h:28:17: note: expected 'char **' but argument is of type 'const char **'

cElementTree.c: In function 'initcElementTree':

cElementTree.c:2573:15: warning: variable 'm' set but not used [-Wunused-but-set-variable]

x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DXML_STATIC -DXML_NS=1 -DXML_DTD=1 -DBYTEORDER=1234 -DXML_CONTEXT_BYTES=1024 -Iexpat -I/usr/include/python2.7 -c expat/xmlparse.c -o build/temp.linux-x86_64-2.7/expat/xmlparse.o

expat/xmlparse.c:75:2: error: #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

有任何想法吗?

编辑:实际上这也开始发生在 12.10 上,因为销毁我的 vagrant box 并回滚到 12.10 并没有摆脱这个错误。

答案1

备份/usr/include/python2.7/pyconfig.h

并将此文件替换为/usr/include/x86_64-linux-gnu/python2.7/pyconfig.h

这是临时方法。我认为如果 Distribute 包或 Ubuntu 更新,那么这个问题就会自动解决。

相关内容