1

安装 IPOPT 并尝试在 Ubuntu 12.04 框中安装 pyipopt,我遇到以下错误:
python setup.py install
导致以下错误:
运行 install
running build
running build_py
running build_ext
building 'pyipoptcore' extension
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
有什么想法吗?

4

1 回答 1

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 文件。

于 2014-03-27T08:41:23.640 回答