2013-06-03 85 views
0

我在RHEL6.3機器(x86 64位)上安裝CPLEX 12.5,它似乎運行良好。然而,當我嘗試使用Python API,我得到以下錯誤:在python 2.7中導入cplex 12.5模塊會產生unicode錯誤

>>> import cplex 
Traceback (most recent call last): 
    File "<stdin>", line 1, in <module> 
    File "cplex/__init__.py", line 43, in <module> 
    import callbacks 
    File "cplex/callbacks.py", line 48, in <module> 
    from _internal._aux_functions import apply_freeform_two_args, apply_freeform_one_arg 
    File "cplex/_internal/__init__.py", line 22, in <module> 
    import _list_array_utils 
    File "cplex/_internal/_list_array_utils.py", line 13, in <module> 
    import _pycplex as CPX 
    File "cplex/_internal/_pycplex.py", line 19, in <module> 
    _pycplex_platform = swig_import_helper() 
    File "cplex/_internal/_pycplex.py", line 15, in swig_import_helper 
    _mod = imp.load_module('_pycplex_platform', fp, pathname, description) 
    File "cplex/_internal/_pycplex_platform.py", line 39, in <module> 
    from cplex._internal.py1013_cplex125 import * 
ImportError: cplex/_internal/py1013_cplex125.so: undefined symbol: PyUnicodeUCS4_Decode 

什麼我可能是做錯了任何指針?

[~] python -c 'import struct; print struct.calcsize("P") * 8' 
64 

回答

0

我想通了什麼是錯的。蟒蛇有incorrect Unicode build type

>>> import sys;print((sys.maxunicode<66000)and'UCS2'or'UCS4') 
UCS2 

所以我重新編譯它使用--enable-unicode=ucs4,現在的模塊導入罰款。