简体   繁体   English

导入 Dash 时出错:“ImportError: DLL load failed while importing _brotli: The specified module could not be found.”

[英]Error when importing Dash: "ImportError: DLL load failed while importing _brotli: The specified module could not be found."

I'm following the tutorial on using Dash and trying the sample code found here: https://dash.plotly.com/layout我正在按照有关使用 Dash 的教程并尝试在此处找到的示例代码: https://dash.plotly.com/layout

After installing dash and running the code, I get the following error message in the traceback:安装 dash 并运行代码后,我在回溯中收到以下错误消息:

Traceback (most recent call last):
  File "app_example.py", line 7, in <module>
    import dash
  File "C:\Users\lizsc\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\dash\__init__.py", line 1, in <module>
    from .dash import Dash, no_update  # noqa: F401
  File "C:\Users\lizsc\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\dash\dash.py", line 18, in <module>
    from flask_compress import Compress
  File "C:\Users\lizsc\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\flask_compress.py", line 10, in <module>
    import brotli
  File "C:\Users\lizsc\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\brotli.py", line 8, in <module>
    import _brotli
ImportError: DLL load failed while importing _brotli: The specified module could not be found.

I'm using Windows 10, Python 3.8.5.我正在使用 Windows 10、Python 3.8.5。 Here are the fixes I've tried so far based on web search result recommendations:以下是我迄今为止根据 web 搜索结果建议尝试过的修复方法:

  1. uninstalling dash, installing wheel, reinstalling dash -> no change in error message卸载破折号,安装轮子,重新安装破折号 - >错误消息没有变化
  2. Uninstall and reinstall brotly -> no change in error message.卸载并重新安装 brotly -> 错误消息没有变化。
  3. Add C:\program files\Python38\scripts to PATH, uninstall and reinstall Dash -> no longer get "include this directory in PATH" warning message when installing Dash, but no change in traceback error message.将 C:\program files\Python38\scripts 添加到 PATH,卸载并重新安装 Dash -> 安装 Dash 时不再收到“include this directory in PATH”警告消息,但回溯错误消息没有变化。
  4. As per suggestion from web search of error, installed matplotlib and imported matplotlib before importing dash -> results in different traceback error specific to matplotlib.根据 web 错误搜索的建议,安装 matplotlib 并在导入破折号之前导入 matplotlib -> 导致特定于 matplotlib 的不同回溯错误。
  5. Installed and ran virtualenv, installed dash on virtualenv and ran code-> no change in error message安装并运行 virtualenv,在 virtualenv 上安装 dash 并运行代码-> 错误消息没有变化
  6. As per https://github.com/google/brotli/issues/782 , installed vc_redist.x86.exe, restarted computer and ran outside of virtualenv-> no change in error message根据https://github.com/google/brotli/issues/782 ,安装了 vc_redist.x86.exe,重新启动计算机并在 virtualenv 之外运行-> 错误消息没有变化
  7. ran virtualenv after vc_redist.x86.exe was installed -> no change in error message安装 vc_redist.x86.exe 后运行 virtualenv -> 错误消息无变化

I definitely consider myself a novice, so any guidance would be appreciated!我绝对认为自己是新手,所以任何指导将不胜感激!

In my case helped installing both vc_redist :在我的例子中,帮助安装了两个vc_redist

x86: vc_redist.x86.exe
x64: vc_redist.x64.exe

from here https://support.microsoft.com/en-gb/help/2977003/the-latest-supported-visual-c-downloads从这里https://support.microsoft.com/en-gb/help/2977003/the-latest-supported-visual-c-downloads

Additionally make sure that you updated Python/Windows and other software to newest versions and restarted machine.此外,请确保将 Python/Windows 和其他软件更新到最新版本并重新启动机器。

Tested on Windows 10 Pro, Python 3.8.5, PyCharm 2020.2.在 Windows 10 Pro、Python 3.8.5、PyCharm 2020.2 上测试。

In my case (windows 10 pro), I installed 'vc_redist.x64.exe'.就我而言(Windows 10 专业版),我安装了“vc_redist.x64.exe”。 you can click here for link to try for your device您可以单击此处获取链接以试用您的设备

Force reinstall dash using --user command:使用--user命令强制重新安装破折号:

pip install dash --force-reinstall --user

In my case, I had a problem with the module of dash named "Derkzeug".就我而言,名为“Derkzeug”的破折号模块有问题。 I followed the next steps:我遵循了以下步骤:

pip list -> To verify the version 

pip install Werkzeuk==2.0.0 -> To downgrade the version of the module

暂无
暂无

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

相关问题 导入 tensorflow 时,出现错误“导入错误:DLL 加载失败:找不到指定的模块。” - While importing tensorflow, got the error 'ImportError: DLL load failed: The specified module could not be found.' 在pycharm ImportError中:DLL加载失败:找不到指定的模块。 导入人脸识别时 - In pycharm ImportError: DLL load failed: The specified module could not be found. while importing facerecognition “ImportError: DLL load failed while importing mariadb: The specified module could not be found”的解决方法。 - Workaround for “ImportError: DLL load failed while importing mariadb: The specified module could not be found.” ImportError:DLL加载失败:找不到指定的模块。 在pycharm中导入cv2时 - ImportError: DLL load failed: The specified module could not be found. when importing cv2 in pycharm 导入 Cartopy 时 ImportError: DLL load failed while importing trace: The specified module could not be found - When importing Cartopy ImportError: DLL load failed while importing trace: The specified module could not be found cx_Freeze ImportError: DLL load failed while importing _ctypes: 找不到指定的模块 - cx_Freeze ImportError: DLL load failed failed while importing _ctypes: The specified module could not be found 无法打开 Jupyter Notebook。 出现错误“导入 libzmq 时 DLL 加载失败:找不到指定的模块。” - Can not open Jupyter Notebook. getting error “ DLL load failed while importing libzmq: The specified module could not be found.” 修复“DLL加载失败:找不到指定的模块。” python 中用于导入光栅的错误 - Fixing "DLL load failed: The specified module could not be found." error in python for importing rasterio 导入已安装的模块时出现“ImportError: DLL load failed: The specified module could not be found” - “ImportError: DLL load failed: The specified module could not be found” when importing installed module (ibm_db) ImportError: DLL load failed while importing ibm_db: The specified module could not be found - (ibm_db) ImportError: DLL load failed while importing ibm_db: The specified module could not be found
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM