import error: ephem/_libastro.so undefined symbol: PyUnicodeUCS2_AsUTF8String

对着背影说爱祢 提交于 2019-12-10 16:56:32

问题


I just successfully installed PyEphem using pip in a pyenv. However, on import I receive:

ImportError: /python2.7/site-packages/ephem/_libastro.so: undefined symbol: PyUnicodeUCS2_AsUTF8String

In looking around I've seen it mentioned that some modules are built "against Python" in regards to Unicode and suggest recompiling. I'm quite new to Python and Ubuntu 14.04, and although I believe this is the answer to my issue, I do not know what recompiling means or how to do it.


回答1:


The symbol PyUnicode_AsUTF8String(value) is used once in _libastro.c and is defined on my system in the file:

/usr/include/python2.7/unicodeobject.h

There it can be aliased one of two ways:

#ifndef Py_UNICODE_WIDE
# ...
# define PyUnicode_AsUTF8String PyUnicodeUCS2_AsUTF8String
# ...
#else
# ...
# define PyUnicode_AsUTF8String PyUnicodeUCS4_AsUTF8String

Your error message makes it sound as though your system Python is compiled to use 4-byte-wide Unicode strings (hence why the linker cannot find a UCS2 version of this function inside of it), but that the version of PyEphem that auto-compiled on your system when you ran pip install somehow got confused and unset Py_UNICODE_WIDE and thus generated C code that was expected a UCS2 symbol.

Do you have several compiled versions of Python on your system, where the Unicode setting of one version could accidentally be affecting how this compile for your system Python takes place?



来源:https://stackoverflow.com/questions/25223993/import-error-ephem-libastro-so-undefined-symbol-pyunicodeucs2-asutf8string

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!