首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法为python安装IPOPT (缺少库依赖)

无法为python安装IPOPT (缺少库依赖)
EN

Stack Overflow用户
提问于 2018-04-23 19:53:51
回答 1查看 638关注 0票数 1

我在/usr/local/从源代码中构建了IPOPT,然后尝试为python python setup.py install安装ipopt。

但是,安装程序抱怨(错误)无法定位IpStdCInterface.h

然后,我修改了setup.py文件的内容如下:(第1行和第3行有错误的路径)

代码语言:javascript
复制
    IPOPT_ICLUDE_DIRS=['/usr/local/include/coin']
    IPOPT_LIBS=['ipopt', 'coinhsl', 'coinlapack', 'coinblas', 'coinmumps', 'coinmetis']
    IPOPT_LIB_DIRS=['/usr/local/lib/']
    IPOPT_DLL=None

我修改了第一行和第三行,以指向正确的目录。

现在,libipopt.so.0,目录路径(在上面的第三行)包含一个名为libipopt.solibipopt.la (同名、不同扩展名)的库文件。

安装程序现在没有抱怨IpStdCInterface.h,但是它无法找到lib

代码语言:javascript
复制
x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wl,-Bsymbolic-functions -Wl,-z,relro -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/src/cyipopt.o -L/usr/local/lib/ -lipopt -lcoinhsl -lcoinlapack -lcoinblas -lcoinmumps -lcoinmetis -o build/lib.linux-x86_64-2.7/ipopt/cyipopt.so
/usr/bin/ld: cannot find -lcoinhsl
/usr/bin/ld: cannot find -lcoinlapack
/usr/bin/ld: cannot find -lcoinblas
/usr/bin/ld: cannot find -lcoinmumps
/usr/bin/ld: cannot find -lcoinmetis
collect2: error: ld returned 1 exit status
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

这些库应该由libipopt.so文件提供吗?还是我需要安装其他的软件包?

EN

回答 1

Stack Overflow用户

发布于 2019-03-19 22:41:12

我和你有同样的问题。我的解决方案是在.bashrc中添加以下命令:

代码语言:javascript
复制
export IPOPT_HOME="/opt/CoinIpopt"

export PATH="${PATH}:${IPOPT_HOME}/bin"

export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${IPOPT_HOME}/lib"

/opt/CoinIpopt是安装IpOpt的路径。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/49988987

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档