How can I call a python function which imports cvxopt in Matlab in Windows?
3 次查看(过去 30 天)
显示 更早的评论
I am trying to use a python function which imports cvxopt module in Matlab. My computer is based on Win10.
When the cvxopt module is not imported, the Matlab can call the python funtion well using py.command. However, such error happens when the cvxopt is imported in python function:
error using __init__><module> (line 50)
Python error ImportError: DLL load failed: can not find the module
error <frozen importlib>_call_with_frames_removed (line 219)
error <frozen importlib>exec_module (line 678)
error <frozen importlib>_load_unlocked (line 665)
error <frozen importlib>_find_and_load_unlocked (line 955)
error <frozen importlib>_find_and_load (line 971)
error <frozen importlib>_gcd_import (line 994)
error __init__>import_module (line 126)
return _bootstrap._gcd_import(name[level:], package, level)
Can anyone help me? Thank you so much
0 个评论
回答(1 个)
Shrinidhi KR
2020-5-8
There seems to be an issue with the python cvxopt library itself and the issues is not arising from matlab end. As it gives error when I tried to import it normally in python script as well. I got the following error:
>>> import cvxopt
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\XXXX\AppData\Local\Programs\Python\Python36\lib\site-packages\cvxopt\__init__.py", line 50, in <module>
import cvxopt.base
ImportError: DLL load failed: The specified module could not be found.
Verify if you are able to successfully import cvxopt in python at your end before using it in matlab. If it works fine in python end then it should get imported properly in matlab as well.
This issue is also mentioned in following links: https://github.com/cvxopt/cvxopt/issues/127
I suggest you try some workarounds mentioned here: https://stackoverflow.com/questions/14778178/import-cvxopt-base-the-specified-module-could-not-be-found
Hope this helps!
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Call Python from MATLAB 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!