Невозможно импортировать пакет 'nlopt' python - PullRequest
0 голосов
/ 16 марта 2020

Установлено nlopt: pip install nlopt в Windows 10.

Python: Python 3.7.1 (default, Dec 10 2018, 22:54:23) [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win32.

Команда import nlopt завершается с сообщением

>>> import nlopt
Traceback (most recent call last):
  File "C:\Users\user\AppData\Local\Continuum\anaconda3\lib\site-packages\nlopt\nlopt.py", line 22, in swig_import_helper
    return importlib.import_module(mname)
  File "C:\Users\user\AppData\Local\Continuum\anaconda3\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 670, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 583, in module_from_spec
  File "<frozen importlib._bootstrap_external>", line 1043, in create_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
ImportError: DLL load failed: The specified module could not be found.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\user\AppData\Local\Continuum\anaconda3\lib\site-packages\nlopt\__init__.py", line 1, in <module>
    from .nlopt import *
  File "C:\Users\user\AppData\Local\Continuum\anaconda3\lib\site-packages\nlopt\nlopt.py", line 25, in <module>
    _nlopt = swig_import_helper()
  File "C:\Users\user\AppData\Local\Continuum\anaconda3\lib\site-packages\nlopt\nlopt.py", line 24, in swig_import_helper
    return importlib.import_module('_nlopt')
  File "C:\Users\user\AppData\Local\Continuum\anaconda3\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ModuleNotFoundError: No module named '_nlopt'

при добавлении 2 команд

>>> import sys
>>> sys.path.append(r'C:\Users\user\AppData\Local\Continuum\anaconda3\lib\site-packages\nlopt')

завершается с другим сообщением:

Traceback (most recent call last):
  File "C:\Users\user\AppData\Local\Continuum\anaconda3\lib\site-packages\nlopt\nlopt.py", line 22, in swig_import_helper
    return importlib.import_module(mname)
  File "C:\Users\user\AppData\Local\Continuum\anaconda3\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 670, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 583, in module_from_spec
  File "<frozen importlib._bootstrap_external>", line 1043, in create_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
ImportError: DLL load failed: The specified module could not be found.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\user\AppData\Local\Continuum\anaconda3\lib\site-packages\nlopt\__init__.py", line 1, in <module>
    from .nlopt import *
  File "C:\Users\user\AppData\Local\Continuum\anaconda3\lib\site-packages\nlopt\nlopt.py", line 25, in <module>
    _nlopt = swig_import_helper()
  File "C:\Users\user\AppData\Local\Continuum\anaconda3\lib\site-packages\nlopt\nlopt.py", line 24, in swig_import_helper
    return importlib.import_module('_nlopt')
  File "C:\Users\user\AppData\Local\Continuum\anaconda3\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ImportError: DLL load failed: The specified module could not be found.
...