在 Google Colab 上为 python 安装 GLPK
Install GLPK on Google Colab for python
我想在 Google Colab 中使用 Pyomo。
我这样做了:
pip install pyomo #works 100%
pip install glpk #error
错误是:
错误:glpk 构建轮失败
运行 setup.py 清理 glpk
构建 glpk 失败
错误:无法为使用 PEP 517 且无法直接安装的 glpk 构建轮子
通常我们建议使用 conda 安装 glpk。我不确定 Google Colab 是否安装了 conda,但如果是这样,命令将是:
conda install -c conda-forge glpk
此外,我建议您看一下 Pyomo 食谱 here 的第 1 章,其中描述了如何设置求解器以与 Pyomo 一起使用,并包括可以 运行 在 [=16] 中的笔记本=] Colab.
需要同时使用apt和pip安装
!pip install pyomo
!apt install glpk-utils
!pip install glpk
我想在 Google Colab 中使用 Pyomo。
我这样做了:
pip install pyomo #works 100%
pip install glpk #error
错误是:
错误:glpk 构建轮失败 运行 setup.py 清理 glpk 构建 glpk 失败 错误:无法为使用 PEP 517 且无法直接安装的 glpk 构建轮子
通常我们建议使用 conda 安装 glpk。我不确定 Google Colab 是否安装了 conda,但如果是这样,命令将是:
conda install -c conda-forge glpk
此外,我建议您看一下 Pyomo 食谱 here 的第 1 章,其中描述了如何设置求解器以与 Pyomo 一起使用,并包括可以 运行 在 [=16] 中的笔记本=] Colab.
需要同时使用apt和pip安装
!pip install pyomo
!apt install glpk-utils
!pip install glpk