我在尝试运行 numpy 时遇到了 unicode 问题。
正如这里和这里所指出的,我使用的是 4 字节 unicode 的 python,我下载了 numpy 1.6.1 源代码并运行 python 安装程序:
在 numpy 源目录中:
which python
/usr/local/bin/python
python -c 'import sys; print sys.maxunicode'
1114111
python setup.py build
python setup.py install
cd ~
python -c 'import numpy'
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/local/lib/python2.6/site-packages/numpy/__init__.py", line 137, in
<module>
import add_newdocs
File "/usr/local/lib/python2.6/site-packages/numpy/add_newdocs.py", line 9,
in <module>
from lib import add_newdoc
File "/usr/local/lib/python2.6/site-packages/numpy/lib/__init__.py", line 4,
in <module>
from type_check import *
File "/usr/local/lib/python2.6/site-packages/numpy/lib/type_check.py", line
8, in <module>
import numpy.core.numeric as _nx
File "/usr/local/lib/python2.6/site-packages/numpy/core/__init__.py",
line 5, in <module>
import multiarray
ImportError: /usr/local/lib/python2.6/site-packages/numpy/core/multiarray.so:
undefined symbol: PyUnicodeUCS2_AsASCIIString
由于我正在使用 4 字节 python unicode 支持编译 numpy,所以我不明白为什么我在 numpy 中有 2 字节 unicode 错误
环境:
- Debian 6 64 位
- Python 2.6.8
- Numpy 1.6.1
对此的任何线索将不胜感激