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

我正在使用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重新安装没有帮助.

请帮忙!

解决方法:

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

上一篇:在雪豹上我需要32位libxml2 for python吗?


下一篇:Python libxml2 XPath /命名空间帮助