如何在Python中安装SCIP

huangapple go评论65阅读模式
英文:

How to install SCIP in python

问题

我实际上是一个.NET程序员(C#),对Python的经验不足,但最近不得不在一个涉及整数优化的Python项目上工作,发现SCIP是一个不错的选择。我尝试使用以下链接安装它:

https://www.scipopt.org/doc-3.2.1/html/PYTHON_INTERFACE.php

但是作为一个新手在Python(和开源)领域,我不知道在哪里运行这个命令:

make SHARED=true scipoptlib

有没有一种简单的方法可以快速安装这个包,这样我就可以开始在Python中使用SCIP了?我在Windows上工作,使用VS Code作为我的IDE(Python 3.11)。目前当我尝试在我的Python文件中导入它时,我得到了'couldn't be resolved'的错误:

from pyscipopt import Model

顺便问一下,我能直接在C#项目中使用SCIP吗?这样对我来说会简单得多。我会感激任何提示或建议。

英文:

I'm actually a .NET programmer (C#), and have not enough experience with Python, but recently had to work on a Python project involving Integer Optimization, and found SCIP a good option. I've tried to install it using the following link:

https://www.scipopt.org/doc-3.2.1/html/PYTHON_INTERFACE.php

But as I'm new in the Python (and open source) world, I don't know where should I run this command:

make SHARED=true scipoptlib

is there any easy way to quickly install the package so I can start working with SCIP in Phyotn? I work on Windows and use VS code as my IDE (Python 3.11)
Currently I get 'couldn't be resolved' error when trying to import it in my Phyton file:

from pyscipopt import Model

BTW, can I use SCIP directly in a C# project? It will then be much easier for me.
I'll be grateful for any tips or hints.

答案1

得分: 3

以下是翻译好的部分:

"By far the easiest way to install PySCIPOpt (the python interface for SCIP) is via conda (this should also work on windows after installing conda). The command is conda install --channel conda-forge pyscipopt.

If conda is not an option for you, you need to first install SCIP (there is a windows installer on the SCIP webpage https://www.scipopt.org/index.php#download) and then you set the SCIPOPTDIR prior to installing the python interface. This is all explained in detail here: https://github.com/scipopt/PySCIPOpt/blob/master/INSTALL.md

Regarding your question, about using SCIP in a C# project: SCIP is natively written in C. So if you know how to use a C library in a C# project then there would be no issue. I think it is possible but since I never used C# myself, I will not try to comment more on this."

英文:

By far the easiest way to install PySCIPOpt (the python interface for SCIP) is via conda (this should also work on windows after installing conda).
The command is conda install --channel conda-forge pyscipopt.

If conda is not an option for you, you need to first install SCIP (there is a windows installer on the SCIP webpage https://www.scipopt.org/index.php#download) and then you set the SCIPOPTDIR prior to installing the python interface. This is all explained in detail here: https://github.com/scipopt/PySCIPOpt/blob/master/INSTALL.md

Regarding your question, about using SCIP in a C# project: SCIP is natively written in C. So if you know how to use a C library in a C# project then there would be no issue. I think it is possible but since I never used C# myself, I will not try to comment more on this.

huangapple
  • 本文由 发表于 2023年2月18日 17:25:27
  • 转载请务必保留本文链接:https://go.coder-hub.com/75492367.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定