Python重新安装--enable-unicode = ucs4和lxml未定义的符号:PyUnicodeUCS2_DecodeLatin1

时间:2015-04-05 17:23:09

标签: python linux ubuntu installation libxml2

我正在使用Ubuntu Server 14.04。 我需要使用./configure --enable-unicode = ucs4选项来创建我的新django项目python。我用ucs4重新安装了python。

现在,当我试图运行scrapy spider时,我收到如下错误:

ImportError: /usr/local/lib/python2.7/site-packages/lxml-3.4.2-py2.7-linux-x86_64.egg/lxml/etree.so: undefined symbol: PyUnicodeUCS2_DecodeLatin1

然后我试图再次重新安装python,但收到错误:

Compiling /usr/local/lib/python2.7/zipfile.py ...
make: *** [libinstall] Error 1

然后我尝试重新安装libxml,但也有错误:

/usr/bin/ld: /usr/local/lib/python2.7/config/libpython2.7.a(abstract.o): relocation R_X86_64_32S against `_Py_NotImplementedStruct' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/python2.7/config/libpython2.7.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status

Scrapy重新安装并没有帮助。

请帮忙!

1 个答案:

答案 0 :(得分:5)

我解决了。 也许这对某人有用。 我使用python dist手动删除sudo rm -R /usr/local/lib/python2.7文件夹,这会导致错误。 然后我从源手动重新安装python,scrapy和django。