Python 재설치 --enable-unicode=ucs4 및 lxml 정의되지 않은 기호: PyUnicodeUCS2_DecodeLatin1

Python 재설치 --enable-unicode=ucs4 및 lxml 정의되지 않은 기호: PyUnicodeUCS2_DecodeLatin1

우분투 서버 14.04를 사용하고 있습니다. 옵션을 사용하여 Python을 컴파일하려면 새 django 프로젝트가 필요했습니다 ./configure --enable-unicode=ucs4. 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

나는 그것을 해결했다.

오류를 일으키는 python dist가 포함된 디렉터리를 수동으로 삭제했습니다.

sudo rm -R /usr/local/lib/python2.7 

그런 다음 소스에서 Python, scrapy 및 django를 수동으로 다시 설치했습니다.

관련 정보