Import cvxopt.base: the specified module was not found

I am new to Python, just installed the cvxopt module for my Python3.3 system (64 bit). The installation was successful, but when I typed "import cvxopt"in the Python command line, it returned an error:

File "C: \ Program Files (x86) \ Python \ lib \ site-packages \ cvxopt__init __. Py", line 33, in import cvxopt.base ImportError: Error loading DLL: the specified module was not found.

Can someone help me in solving this problem? Many thanks!

+5
source share
7 answers

You need to import numpy first before importing cvxopt.

import numpy
import cvxopt
+11
source

CVXOPT numpy + mkl, numpy numpy + mkl http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy, CVXOPT, .

+3

cvxopt.base pyd ( , Windows DLL). "C:\Program Files (x86)\Python\lib\site-packages\cvxopt". , PYTHONPATH. , ​​ :

import sys
sys.path.append("C:\Program Files (x86)\Python\lib\site-packages\cvxopt")

, !

+1

DLL, , . Anaconda (, Anaconda 5.0.1) Numpy MKL. . , , conda. , cvxopt dll,

C:\Anaconda3\envs\foo\Library\mingw-w64\bin  

Anaconda , python Anaconda ( ), Anaconda prommpt ( cvxopt Python 3.5)

conda create -n foo python=3.5
activate foo

conda install cvxopt

cvxopt

(foo) C:\tmp>python
Python 3.5.4 |Anaconda, Inc.| (default, Nov  8 2017, 14:34:30) [MSC v.1900 
64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import cvxopt
>>> 

. , Anaconda,

C:\Anaconda3\envs\foo;
C:\Anaconda3\envs\foo\Library\mingw-w64\bin;
C:\Anaconda3\envs\foo\Library\usr\bin;
C:\Anaconda3\envs\foo\Library\bin;
C:\Anaconda3\envs\foo\Scripts;

C:\Anaconda3\envs\foo\Library\mingw-w64\bin ,

C:\tmp>python
Python 3.5.4 |Anaconda, Inc.| (default, Nov  8 2017, 14:34:30) [MSC v.1900 
64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import cvxopt
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Anaconda3\envs\tf14\lib\site-packages\cvxopt\__init__.py", line 32, in <module>
    import cvxopt.base
ImportError: DLL load failed: The specified module could not be found.
>>>

, PyCharm: Anaconda PyCharm? PyCharm , . , . .

+1

ImportError cvxopt. cvxopt python 2.7-3.5, conda python 3.5, :

  • Anaconda
  • conda create -n python = 3.5

conda cvxopt : conda install cvxopt

cvxopt .

spyder, spyder Anaconda, Spyder .

cvxopt - .

. Pycharm, , , spyder.

0

, , python 3.5 ( ). , cvxopt , , python 3.6.

0

PyCharm 2018.1 Conda. Anaconda, :

conda activate cvxopt_test
python -c "import cvxopt"

However, when starting up import cvxoptin PyCharm, an error occurs that you describe. As Daniel mentioned in his underwriter, this is due to the Windows PATH variable (os.environ['PATH']). Somehow PyCharm does not add the cvxopt folder when running the code. For me, a minimal working example to avoid error:

import os
# add the folder containing the DLL to the PATH variable
os.environ['PATH'] += r';C:\Anaconda3\envs\foo\Library\mingw-w64\bin'

Although it would be wise to add all the folders that Daniel mentions in the PATH variable in the same way.

0
source

All Articles