Python docx安装是';linux上出现未知错误,无法正常工作

Python docx安装是';linux上出现未知错误,无法正常工作,python,pip,python-docx,Python,Pip,Python Docx,我正在尝试安装pip安装pythondocx,但出现以下错误。为什么不起作用 building 'lxml.etree' extension creating build/temp.linux-x86_64-2.7 creating build/temp.linux-x86_64-2.7/src creating build/temp.linux-x86_64-2.7/src/lxml gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -

我正在尝试安装pip安装pythondocx,但出现以下错误。为什么不起作用

building 'lxml.etree' extension

creating build/temp.linux-x86_64-2.7

creating build/temp.linux-x86_64-2.7/src

creating build/temp.linux-x86_64-2.7/src/lxml

gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/include/libxml2 -I/tmp/pip_build_plakshma/lxml/src/lxml/includes -I/opt/python2.7/include/python2.7 -c src/lxml/lxml.etree.c -o build/temp.linux-x86_64-2.7/src/lxml/lxml.etree.o -w

gcc -pthread -shared build/temp.linux-x86_64-2.7/src/lxml/lxml.etree.o -L/usr/lib64 -L. -lxslt -lexslt -lxml2 -lz -lm -lpython2.7 -o build/lib.linux-x86_64-2.7/lxml/etree.so

/usr/bin/ld: /usr/local/lib/libpython2.7.a(abstract.o): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC

/usr/local/lib/libpython2.7.a: could not read symbols: Bad value

collect2: ld returned 1 exit status

error: command 'gcc' failed with exit status 1

在终端/cmd中键入此命令。
pip安装python docx


对我来说,当我在apple终端中键入它时,这是一个错误,但在Pycharm终端中键入,它应该可以工作。

您使用的是什么Python和lxml版本?您的操作系统是什么?Red Hat Enterprise Linux Server版本5.10(Tikanga),python2.7您已经构建了自己的python2.7,但错误地说,lib无法正确地重新定位。如何解决此问题?请提供完整的解决方案/答案