【问题标题】:Python docx installation isn't working due to unknown error on linux由于 linux 上出现未知错误,Python docx 安装无法正常工作
【发布时间】:2014-07-31 14:21:26
【问题描述】:

我正在尝试安装 pip install python-docx 但收到以下错误。为什么它不起作用?

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

【问题讨论】:

  • 您使用的是什么 Python 和 lxml 版本?你的操作系统是什么?
  • 红帽企业 Linux 服务器版本 5.10 (Tikanga),python2.7
  • 你已经构建了自己的python2.7,但是错误地,lib不能正确重定位。
  • 我该如何解决这个问题?

标签: python pip python-docx


【解决方案1】:

在您的终端/cmd 中键入它。 pip install python-docx

对我来说,当我在苹果终端中输入它是一个错误,但在 Pycharm 终端中输入它应该可以工作。

【讨论】:

  • 请提供完整的解决方案/答案
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2018-03-08
  • 1970-01-01
  • 1970-01-01
  • 2021-08-02
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多