如何在Alpine Linux上安装GLPK?

时间:2016-10-05 11:35:44

标签: python linux installation glpk alpine

在Alpine Linux上安装swiglpk软件包失败,并带有以下跟踪:

Collecting swiglpk>=1.2.14; extra == "all" (from cameo[all]==0.6.3->-r requirements.txt (line 1))
   Downloading swiglpk-1.2.14.tar.gz
Complete output from command python setup.py egg_info:
which: no glpsol in (/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin)
Trying to determine glpk.h location
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/tmp/pip-build-_g57y7ed/swiglpk/setup.py", line 45, in <module>
    copy_glpk_header()
  File "/tmp/pip-build-_g57y7ed/swiglpk/setup.py", line 28, in copy_glpk_header
    glpsol_path = os.path.dirname(subprocess.check_output(['which', 'glpsol']))
  File "/usr/local/lib/python3.5/subprocess.py", line 626, in check_output
    **kwargs).stdout
  File "/usr/local/lib/python3.5/subprocess.py", line 708, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['which', 'glpsol']' returned non-zero exit status 1

因此在路径中找不到glpsol

如果可能,如何在Alpine Linux上安装glpk / glpsol

1 个答案:

答案 0 :(得分:3)

因为Alpine还没有glpk包,可以从源

安装
wget ftp://ftp.gnu.org/gnu/glpk/glpk-4.55.tar.gz
tar -xzvf glpk-4.55.tar.gz
cd glpk-4.55
./configure
make install

要确保其有效,请运行which glpsol