安装了IPOPT并尝试在Ubuntu 12.04框中安装pyipopt,我遇到了以下错误:
python setup.py install
导致以下错误:
运行安装
正在建造中
运行build_py
运行build_ext
建立'pyipoptcore'扩展
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I / usr / lib / python2.7 / dist-packages / numpy / core / include -I / usr / local / include / coin / -I / usr / include / python2.7 -c src / callback.c -o build / temp.linux-x86_64-2.7 / src / callback.o
在src / callback.c中包含的文件中:36:0:
src / hook.h:5:29:致命错误:IpStdCInterface.h:没有这样的文件或目录
编译终止。
错误:命令'gcc'因退出状态1而失败
任何想法?
答案 0 :(得分:1)
这是编译所需的ipopt库的接口。如setup.py
文件中所述
# You will probably have to edit this file in unpredictable ways
# if you want pyipopt to work for you, sorry.
处理此问题的最简单方法是相应地调整setup.py
:
# When I installed Ipopt from source, I used the
# --prefix=/usr/local
# option, so this is where I want pyipopt to look for my ipopt installation.
# I only installed from source because the ipopt packaging
# for my linux distribution was buggy,
# so by the time you read this the bugs have probably been fixed
# and you will want to specify a different directory here.
IPOPT_DIR = '/usr/local/'
将IPOPT_DIR
调整到您系统上已安装库的路径,当然应该已经进行了。
编辑:
如果从源代码安装,只需使用--prefix=/usr/local
作为配置脚本,并通过运行make; sudo make install
来编译和安装库。然后,您不必更改setup.py文件。