gpt4 book ai didi

python - 如何使用 python 安装 CPLEX?

转载 作者:太空狗 更新时间:2023-10-30 02:44:14 37 4
gpt4 key购买 nike

我正在尝试为 python 2.7.9 安装 cplex。我下载了 IBM ILOG CPLEX Studio Preview 12.6.1 32 位,并尝试从 Pycharm 安装它(使用 GUI 和安装包按钮),但我收到此错误消息:

Figuring out CPlex setup.


Targeting 32bit platform.

Traceback (most recent call last):

File "<string>", line 17, in <module>

File "C:\Users\me\AppData\Local\Temp\pycharm-packaging0.tmp\pycpx\setup.py", line 148, in <module>

"concert include directory", 'and', '', False)

File "C:\Users\me\AppData\Local\Temp\pycharm-packaging0.tmp\pycpx\setup.py", line 145, in find_path

% (name, (', '.join(goal_list))))

Exception: CPLEX concert include directory not found: please set environment variable CPLEX_PATH to point to the base of the CPlex/Concert installation. Attempting to find files: ilconcert/iloexpression.h, ilconcert/iloalg.h, ilconcert/iloenv.h, ilconcert/ilosolution.h.

----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in C:\Users\me\AppData\Local\Temp\pycharm-packaging0.tmp\pycpx
Storing debug log for failure in C:\Users\me\pip\pip.log

或者,我尝试使用 python setup.py installcmd.exe 安装它,我得到了这个输出:

C:\Program Files (x86)\IBM\ILOG\CPLEX_Studio_Preview1261\cplex\python\2.7\x86_win32>python setup.py
install
running install
running build
running build_py
creating build
creating build\lib
creating build\lib\cplex
copying cplex\callbacks.py -> build\lib\cplex
copying cplex\six.py -> build\lib\cplex
copying cplex\__init__.py -> build\lib\cplex
creating build\lib\cplex\_internal
copying cplex\_internal\_aux_functions.py -> build\lib\cplex\_internal
copying cplex\_internal\_constants.py -> build\lib\cplex\_internal
copying cplex\_internal\_list_array_utils.py -> build\lib\cplex\_internal
copying cplex\_internal\_matrices.py -> build\lib\cplex\_internal
copying cplex\_internal\_ostream.py -> build\lib\cplex\_internal
copying cplex\_internal\_parameters_auto.py -> build\lib\cplex\_internal
copying cplex\_internal\_parameter_classes.py -> build\lib\cplex\_internal
copying cplex\_internal\_parameter_hierarchy.py -> build\lib\cplex\_internal
copying cplex\_internal\_procedural.py -> build\lib\cplex\_internal
copying cplex\_internal\_pycplex.py -> build\lib\cplex\_internal
copying cplex\_internal\_pycplex_platform.py -> build\lib\cplex\_internal
copying cplex\_internal\_subinterfaces.py -> build\lib\cplex\_internal
copying cplex\_internal\__init__.py -> build\lib\cplex\_internal
creating build\lib\cplex\exceptions
copying cplex\exceptions\error_codes.py -> build\lib\cplex\exceptions
copying cplex\exceptions\__init__.py -> build\lib\cplex\exceptions
copying cplex\_internal\py27_cplex1261.pyd -> build\lib\cplex\_internal
copying cplex\_internal\cplex1261.dll -> build\lib\cplex\_internal
running install_lib
copying build\lib\cplex\callbacks.py -> C:\Python27\Lib\site-packages\cplex
copying build\lib\cplex\exceptions\error_codes.py -> C:\Python27\Lib\site-packages\cplex\exceptions
copying build\lib\cplex\exceptions\__init__.py -> C:\Python27\Lib\site-packages\cplex\exceptions
copying build\lib\cplex\six.py -> C:\Python27\Lib\site-packages\cplex
copying build\lib\cplex\_internal\cplex1261.dll -> C:\Python27\Lib\site-packages\cplex\_internal
copying build\lib\cplex\_internal\py27_cplex1261.pyd -> C:\Python27\Lib\site-packages\cplex\_interna
l
copying build\lib\cplex\_internal\_aux_functions.py -> C:\Python27\Lib\site-packages\cplex\_internal

copying build\lib\cplex\_internal\_constants.py -> C:\Python27\Lib\site-packages\cplex\_internal
copying build\lib\cplex\_internal\_list_array_utils.py -> C:\Python27\Lib\site-packages\cplex\_inter
nal
copying build\lib\cplex\_internal\_matrices.py -> C:\Python27\Lib\site-packages\cplex\_internal
copying build\lib\cplex\_internal\_ostream.py -> C:\Python27\Lib\site-packages\cplex\_internal
copying build\lib\cplex\_internal\_parameters_auto.py -> C:\Python27\Lib\site-packages\cplex\_intern
al
copying build\lib\cplex\_internal\_parameter_classes.py -> C:\Python27\Lib\site-packages\cplex\_inte
rnal
copying build\lib\cplex\_internal\_parameter_hierarchy.py -> C:\Python27\Lib\site-packages\cplex\_in
ternal
copying build\lib\cplex\_internal\_procedural.py -> C:\Python27\Lib\site-packages\cplex\_internal
copying build\lib\cplex\_internal\_pycplex.py -> C:\Python27\Lib\site-packages\cplex\_internal
copying build\lib\cplex\_internal\_pycplex_platform.py -> C:\Python27\Lib\site-packages\cplex\_inter
nal
copying build\lib\cplex\_internal\_subinterfaces.py -> C:\Python27\Lib\site-packages\cplex\_internal

copying build\lib\cplex\_internal\__init__.py -> C:\Python27\Lib\site-packages\cplex\_internal
copying build\lib\cplex\__init__.py -> C:\Python27\Lib\site-packages\cplex
byte-compiling C:\Python27\Lib\site-packages\cplex\callbacks.py to callbacks.pyc
byte-compiling C:\Python27\Lib\site-packages\cplex\exceptions\error_codes.py to error_codes.pyc
byte-compiling C:\Python27\Lib\site-packages\cplex\exceptions\__init__.py to __init__.pyc
byte-compiling C:\Python27\Lib\site-packages\cplex\six.py to six.pyc
byte-compiling C:\Python27\Lib\site-packages\cplex\_internal\_aux_functions.py to _aux_functions.pyc

byte-compiling C:\Python27\Lib\site-packages\cplex\_internal\_constants.py to _constants.pyc
byte-compiling C:\Python27\Lib\site-packages\cplex\_internal\_list_array_utils.py to _list_array_uti
ls.pyc
byte-compiling C:\Python27\Lib\site-packages\cplex\_internal\_matrices.py to _matrices.pyc
byte-compiling C:\Python27\Lib\site-packages\cplex\_internal\_ostream.py to _ostream.pyc
byte-compiling C:\Python27\Lib\site-packages\cplex\_internal\_parameters_auto.py to _parameters_auto
.pyc
byte-compiling C:\Python27\Lib\site-packages\cplex\_internal\_parameter_classes.py to _parameter_cla
sses.pyc
byte-compiling C:\Python27\Lib\site-packages\cplex\_internal\_parameter_hierarchy.py to _parameter_h
ierarchy.pyc
byte-compiling C:\Python27\Lib\site-packages\cplex\_internal\_procedural.py to _procedural.pyc
byte-compiling C:\Python27\Lib\site-packages\cplex\_internal\_pycplex.py to _pycplex.pyc
byte-compiling C:\Python27\Lib\site-packages\cplex\_internal\_pycplex_platform.py to _pycplex_platfo
rm.pyc
byte-compiling C:\Python27\Lib\site-packages\cplex\_internal\_subinterfaces.py to _subinterfaces.pyc

byte-compiling C:\Python27\Lib\site-packages\cplex\_internal\__init__.py to __init__.pyc
byte-compiling C:\Python27\Lib\site-packages\cplex\__init__.py to __init__.pyc
running install_egg_info
Removing C:\Python27\Lib\site-packages\cplex-12.6.1.0-py2.7.egg-info
Writing C:\Python27\Lib\site-packages\cplex-12.6.1.0-py2.7.egg-info

但是当我输入 import cplex 时,我得到了这个错误:

import cplex
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\IPython\core\interactiveshell.py", line 2735, in run_code
exec code_obj in self.user_global_ns, self.user_ns
File "<ipython-input-11-062a62e47666>", line 1, in <module>
import cplex
File "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 4.5\helpers\pydev\pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "C:\Python27\lib\site-packages\cplex\__init__.py", line 43, in <module>
from . import _internal
File "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 4.5\helpers\pydev\pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "C:\Python27\lib\site-packages\cplex\_internal\__init__.py", line 21, in <module>
from . import _aux_functions
ImportError: cannot import name _aux_functions

谁能帮帮我?

最佳答案

您可能只想在环境变量中设置路径,以便 python 告知 CPLEX 位于此位置。像 CPLEXhome/python/PLATFORM/。

关于python - 如何使用 python 安装 CPLEX?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30400421/

37 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com