python:undefined symbol: PyUnicodeUCS*问题
2015-07-24 11:47
681 查看
When importing module X, why do I get “undefined symbol: PyUnicodeUCS2*”?
You are using a version of Python that uses a 4-byte representation for Unicode characters, but some C extension module you are importing was compiled using a Python that uses a 2-byte representation for Unicode characters (the default).If instead the name of the undefined symbol starts with PyUnicodeUCS4, the problem is the reverse: Python was built using 2-byte Unicode characters, and the extension module was compiled using a Python with 4-byte Unicode characters.
This can easily occur when using pre-built extension packages. RedHat Linux 7.x, in particular, provided a “python2” binary that is compiled with 4-byte Unicode. This only causes the link failure if the extension uses PyUnicode_FromUnicode or any other of the PyUnicode functions. It is also a problem if an extension uses any of the Unicode-related format specifiers for Py_BuildValue (or similar) or parameter specifications for PyArg_ParseTuple.
You can check the size of the Unicode character a Python interpreter is using by checking the value of sys.maxunicode:
>>> import sys >>> if sys.maxunicode > 65535: ... print 'UCS4 build' ... else: ... print 'UCS2 build'
The only way to solve this problem is to use extension modules compiled with a Python binary built using the same size for Unicode characters.
相关文章推荐
- Python下opencv使用笔记(十二)(k均值算法之图像分割)
- 小白学python(一) 最简单的代码片段
- Hadoop的Python框架指南
- windows下的python和pip安装
- 详解Python的Django框架中的中间件
- python学习笔记(零碎)
- Python version 2.7 required, which was not found in the registry
- 浅谈Python的Django框架中的缓存控制
- 基于Python的标准库tkinter创建面向对象的GUI应用程序
- Python3抓取煎蛋妹子图
- python test postgresql
- [python爬虫] 抓取糗事百科的爬虫程序
- Python-常用库扩展
- ac53 python中文输入输出在windows下的cmd中的实现
- VELT-0.1.5开发:在VS2013下进行python开发
- python 例子1
- python 例子1
- python 例子1
- python 例子1
- python 例子1