简体   繁体   English

无法安装IPOPT for python(缺少库依赖性)

[英]Unable to install IPOPT for python (missing library dependency)

I built IPOPT from source at /usr/local/ Then I tried to install ipopt for python python setup.py install 我从/usr/local/源代码构建了IPOPT,然后尝试为python python setup.py install安装ipopt。

However the installer complained (error) that it could not locate IpStdCInterface.h 但是,安装程序抱怨 (错误)无法找到IpStdCInterface.h
I then modified the content of setup.py file as follows: (line 1 and 3 had wrong paths) 然后,我按如下所示修改setup.py文件的内容:(第1行和第3行的路径错误)

    IPOPT_ICLUDE_DIRS=['/usr/local/include/coin']
    IPOPT_LIBS=['ipopt', 'coinhsl', 'coinlapack', 'coinblas', 'coinmumps', 'coinmetis']
    IPOPT_LIB_DIRS=['/usr/local/lib/']
    IPOPT_DLL=None

I modified the first and third line to point to the correct directory. 我修改了第一行和第三行以指向正确的目录。

Now, the lib directory path (in the third line above) contains a library file named libipopt.so , libipopt.so.0 , libipopt.la (same name, different extensions). 现在, lib目录路径(在上面的第三行中)包含一个名为libipopt.solibipopt.so.0libipopt.la (相同名称,不同扩展名)的库文件。

The setup is now not complaining about IpStdCInterface.h but it is unable to find the libs 现在,安装程序没有抱怨IpStdCInterface.h但是找不到库

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

Those libs should be provided by the libipopt.so file? 那些库应该由libipopt.so文件提供吗? Or do I need to install some other package? 还是我需要安装其他软件包?

Well, i have a same problem as you. 好吧,我和你有同样的问题。 My solution was add the following commands in .bashrc: 我的解决方案是在.bashrc中添加以下命令:

export IPOPT_HOME="/opt/CoinIpopt"

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

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

/opt/CoinIpopt is the path which the IpOpt was installed. / opt / CoinIpopt是安装IpOpt的路径。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM