我在RHEL6.3计算机(x86 64位)上安装了CPLEX 12.5,它似乎运行正常。但是,当我尝试使用Python API时,我收到以下错误:
>>> 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 :(得分:0)
我弄清楚出了什么问题。 Python有incorrect Unicode build type:
>>> import sys;print((sys.maxunicode<66000)and'UCS2'or'UCS4')
UCS2
所以我使用--enable-unicode=ucs4
重新编译它,现在模块导入正常。