简体   繁体   English

Python Gurobi导入错误:DLL加载失败

[英]Python Gurobi import error: DLL load failed

I have installed Gurobi on my Windows 10 machine and I'm trying to use it in Python. 我已经在Windows 10计算机上安装了Gurobi,并且正在尝试在Python中使用它。 Trying to import import gurobipy yields the following error: 尝试导入import gurobipy产生以下错误:

Traceback (most recent call last):
  File "C:\Users\me\test.py", line 4, in <module>
    import gurobipy
  File "C:\Users\me\AppData\Local\Programs\Python\Python37-32\lib\site-packages\gurobipy\__init__.py", line 1, in <module>
    from .gurobipy import *
ImportError: DLL load failed: %1 is not a valid Win32 application.

Running gurobi from the command line works fine. 从命令行运行gurobi可以正常工作。

What does ImportError: DLL load failed: %1 is not a valid Win32 application. ImportError: DLL load failed: %1 is not a valid Win32 application. mean? 意思?

Looking at your trace I see 看着你的踪迹,我看到了

File "C:\Users\me\AppData\Local\Programs\Python\Python37-32\

which suggests that you are using a 32 bit build of Python 3.7. 这表明您使用的是Python 3.7的32位版本。 However current Gurobi distributions only ship with a gurobipy Python extension compiled for 64 bit Python versions. 但是,当前的Gurobi发行版仅附带针对64位Python版本编译的gurobipy Python扩展。 You need to use a 64 bit Python build to use the gurobipy extension. 您需要使用64位Python版本才能使用gurobipy扩展。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM