我已经建立了一个环境,其中所有包都由conda管理(即使对于gcc)。我想要做的是安装,cvxopt与GLPK支持:
CVXOPT_BUILD_GLPK=1 pip install cvxopt
直接导致
src/C/glpk.c:24:18: fatal error: glpk.h: No such file or directory
#include <glpk.h>
^
compilation terminated.
error: command 'gcc' failed with exit status 1
所以我用conda安装了glpk:
conda install -c conda-forge glpk=4.60
再试一次:
CVXOPT_BUILD_GLPK=1 pip install cvxopt
获取错误:
src/C/umfpack.c:23:21: fatal error: umfpack.h: No such file or directory
#include "umfpack.h"
^
compilation terminated.
error: command 'gcc' failed with exit status 1
所以我尝试用以下方法解决它:
conda install -c conda-forge scikit-umfpack=0.2.3
所以在这种情况下,CVXOPT_BUILD_GLPK=1 pip install cvxopt
成功,
但是,当我尝试运行python程序时:
Traceback (most recent call last):
File "my_programme.py", line 19, in <module>
from cvxopt import normal, matrix
File "/home/me/anaconda2/lib/python2.7/site-packages/cvxopt/__init__.py", line 32, in <module>
import cvxopt.base
ImportError: /home/me/anaconda2/lib/python2.7/site-packages/cvxopt/base.so: undefined symbol: _gfortran_st_write_done
我不知道如何解决这个问题....任何帮助?谢谢。我更愿意使用conda管理所有程序....
修改:之后我尝试了:
pip uninstall cvxopt
conda install -c jjhelmus cvxopt_glpk=1.1.6
然后我收到了这个错误:
File "my_code.py", line 19, in <module>
from cvxopt import normal, matrix
File "/home/me/anaconda2/lib/python2.7/site-packages/cvxopt/__init__.py", line 32, in <module>
import cvxopt.base
ImportError: liblapack.so.3gf: cannot open shared object file: No such file or directory
我真的不确定为什么即使在我使用conda统一管理我的软件包后也必须如此复杂....此外,在我做完所有这些混乱之后......我的系统也变得越来越麻烦。我对这一切感到非常沮丧......
现在......我即将崩溃......我完全删除conda并安装conda clean ...然后再做
conda install -c jjhelmus cvxopt_glpk=1.1.6
运行程序后,我得到:
Traceback (most recent call last):
File "extract_small_confgs_from_GMC.py", line 19, in <module>
from cvxopt import normal, matrix
File "/home/me/anaconda2/lib/python2.7/site-packages/cvxopt/__init__.py", line 32, in <module>
import cvxopt.base
ImportError: liblapack.so.3gf: cannot open shared object file: No such file or directory
哦,我的上帝......
答案 0 :(得分:1)
我用以下方法解决了我的问题:
conda install -c conda-forge glpk=4.60
conda install -c conda-forge cvxopt=1.1.8
基本上,我们需要使用一致的condo-forge的一切。例如他们的glpk和cvxopt。