Python 在Windows10上安装pyglpk软件包

Python 在Windows10上安装pyglpk软件包,python,pip,installation,glpk,Python,Pip,Installation,Glpk,我不太了解安装软件包等的技术细节,所以这可能是一个愚蠢的问题。我只是先下载了GLPK并将其添加到路径中,然后尝试通过pip install GLPK安装pyglpk,这会给出以下错误消息: Collecting glpk Using cached https://files.pythonhosted.org/packages/74/e0/8676d8d5404a8f9aee298985d21aae67b776476b01583ff1a3e0030e2f51/glpk-0.4.5.tar.gz

我不太了解安装软件包等的技术细节,所以这可能是一个愚蠢的问题。我只是先下载了GLPK并将其添加到路径中,然后尝试通过
pip install GLPK
安装pyglpk,这会给出以下错误消息:

Collecting glpk
  Using cached https://files.pythonhosted.org/packages/74/e0/8676d8d5404a8f9aee298985d21aae67b776476b01583ff1a3e0030e2f51/glpk-0.4.5.tar.gz
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Building wheels for collected packages: glpk
  Building wheel for glpk (PEP 517) ... error
  ERROR: Complete output from command 'C:\Users\User\Anaconda3\python.exe' 'C:\Users\User\Anaconda3\lib\site-packages\pip\_vendor\pep517\_in_process.py' build_wheel 'C:\Users\User\AppData\Local\Temp\tmpzvxrzwqg':
  ERROR: running bdist_wheel
  running build
  running build_ext
  building 'glpk' extension
  creating build
  creating build\temp.win-amd64-3.7
  creating build\temp.win-amd64-3.7\Release
  creating build\temp.win-amd64-3.7\Release\src
  C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.15.26726\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DVERSION_NUMBER="0.4.5" -IC:\Users\User\Anaconda3\include -IC:\Users\User\Anaconda3\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.15.26726\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\cppwinrt" /Tcsrc\glpk.c /Fobuild\temp.win-amd64-3.7\Release\src\glpk.obj
  glpk.c
  c:\users\user\appdata\local\temp\pip-install-m71t9t2y\glpk\src\lp.h(24): fatal error C1083: Cannot open include file: 'glpk.h': No such file or directory
  error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\VC\\Tools\\MSVC\\14.15.26726\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2
  ----------------------------------------
  ERROR: Failed building wheel for glpk
  Running setup.py clean for glpk
Failed to build glpk
ERROR: Could not build wheels for glpk which use PEP 517 and cannot be installed directly

我试图在线搜索不同的安装教程或问题,但大多数都是针对Linux/MacOS的,而不是针对Windows的。对此我能做些什么呢?

我找到了一个在python中运行glpk而不使用PIP的解决方案。我也遇到同样的问题,无法用皮普解决

第一件事是下载GLPK解算器: GLPK基于C。您必须检查名为glpsol.exe的文件的位置 并将该目录添加到路径中。


之后,您可以运行pyomo模型并选择GLPK作为您的解算器。

我找到了一个在python中运行GLPK而不使用PIP的解决方案。我也遇到同样的问题,无法用皮普解决

第一件事是下载GLPK解算器: GLPK基于C。您必须检查名为glpsol.exe的文件的位置 并将该目录添加到路径中。


之后,您可以运行pyomo模型并选择GLPK作为求解器。

它正在文件夹
C:\Users\User\Anaconda3\include
中查找
GLPK.h
。通过将glpk安装中的
glpk.h
复制到该文件夹中,可以使安装成功。您还需要将
glpk.lib
复制到
C:\Users\User\Anaconda3\libs
它正在文件夹
C:\Users\User\Anaconda3\include
中查找
glpk.h
。通过将glpk安装中的
glpk.h
复制到该文件夹中,可以使安装成功。您还需要将
glpk.lib
复制到
C:\Users\User\Anaconda3\libs

中,该链接似乎是用于在Windows中安装glpk的,我已经成功地完成了,但我一直在安装Python包。谢谢。我也试过了,但是在Windows中没有
sudomakeinstall
命令,所以我在这里迷路了。在Windows中应该使用什么命令?该链接似乎是用于在Windows中安装GLPK的,我已经成功地完成了这项工作,但我一直在安装Python包。谢谢。我也试过了,但是在Windows中没有
sudomakeinstall
命令,所以我在这里迷路了。在Windows中应该使用什么命令?