Error installing and using numpy

2019-09-07 03:22发布

问题:

I'm having unicode troubles trying to run numpy.

As pointed here and and here i'm using python with 4 bytes unicode, I downloaded the numpy 1.6.1 source code and run the python installer:

in the numpy source directory:

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

Since i'm compiling numpy with 4-bytes python unicode support, I don´t get why i'm having the 2-bytes unicode error in numpy

Environment:

  • Debian 6 64 bits
  • Python 2.6.8
  • Numpy 1.6.1

Any clues on this will be apreciated

回答1:

Somehow I managed to get this working: had a very messy environment and starting from scratch was the solution.