微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

使用Python设置Gurobi

如何解决使用Python设置Gurobi

我正在尝试在Gurobi中使用Python。作为IDE,我使用PyCharm。当我通过gurobipy安装PyCharm时,收到以下错误

enter image description here

我还尝试通过Anaconda安装该库,如this link所示。但是,我收到另一个错误,如下所示。

(base) C:\Users\...>conda install -c gurobi gurobi
Collecting package Metadata (current_repodata.json): done
Solving environment: Failed with initial frozen solve. retrying with flexible solve.
Solving environment: Failed with repodata from current_repodata.json,will retry with next repodata source.
Collecting package Metadata (repodata.json): done
Solving environment: Failed with initial frozen solve. retrying with flexible solve.
Solving environment: -
Found conflicts! Looking for incompatible packages.
This can take several minutes.  Press CTRL-C to abort.
Failed

UnsatisfiableError: The following specifications were found
to be incompatible with the existing python installation in your environment:

Specifications:

  - gurobi -> python[version='2.7.*|3.5.*|>=2.7,<2.8.0a0|>=3.6,<3.7.0a0|>=3.7,<3.8.0a0|3.4.*']

Your python: python=3.8

If python is on the left-most side of the chain,that's the version you've asked for.
When python appears to the right,that indicates that the thing on the left is somehow
not available for the python version you are constrained to. Note that conda will not
change your python version to a different minor version unless you explicitly specify
that.

The following specifications were found to be incompatible with your CUDA driver:

  - feature:/win-64::__cuda==11.0=0
  - feature:|@/win-64::__cuda==11.0=0

Your installed CUDA driver is: 11.0

我的学术版本为Gurobi 9.0.2,并在Python 3.8.3中使用Windows 10。我想知道如何解决这个问题。

解决方法

我无法发表评论,但似乎您使用的python版本与gurobipy库/软件包不兼容。您可能希望使用Python 3.7创建一个新的conda环境,并尝试将gurobipy库下载到该conda环境中。这是进行此操作https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html

的参考

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。