【问题标题】:Seaborn ImportError: DLL load failed: The specified module could not be foundSeaborn ImportError: DLL load failed: 找不到指定的模块
【发布时间】:2017-04-21 18:02:23
【问题描述】:

我收到“ImportError:DLL 加载失败:找不到指定的模块”。导入模块时seaborn

我尝试卸载 seaborn 和 matplotlib,然后使用重新安装

pip install seaborn 

但没有运气。我仍然得到同样的错误。

ImportError                               Traceback (most recent call last)
<ipython-input-5-085c0287ecb5> in <module>()
----> 1 import seaborn

C:\Users\johnsam\venv\lib\site-packages\seaborn\__init__.py in <module>()
      4 
      5 # Import seaborn objects
----> 6 from .rcmod import *
      7 from .utils import *
      8 from .palettes import *

C:\Users\johnsam\venv\lib\site-packages\seaborn\rcmod.py in <module>()
      6 import matplotlib as mpl
      7 
----> 8 from . import palettes, _orig_rc_params
      9 
     10 

C:\Users\johnsam\venv\lib\site-packages\seaborn\palettes.py in <module>()
     10 from .external.six.moves import range
     11 
---> 12 from .utils import desaturate, set_hls_values, get_color_cycle
     13 from .xkcd_rgb import xkcd_rgb
     14 from .crayons import crayons

C:\Users\johnsam\venv\lib\site-packages\seaborn\utils.py in <module>()
      6 
      7 import numpy as np
----> 8 from scipy import stats
      9 import pandas as pd
     10 import matplotlib as mpl

C:\Program Files\Continuum\Anaconda3\lib\site-packages\scipy\stats\__init__.py in <module>()
    332 from __future__ import division, print_function, absolute_import
    333 
--> 334 from .stats import *
    335 from .distributions import *
    336 from .rv import *

C:\Program Files\Continuum\Anaconda3\lib\site-packages\scipy\stats\stats.py in <module>()
    179 from scipy.lib.six import callable, string_types
    180 from numpy import array, asarray, ma, zeros, sum
--> 181 import scipy.special as special
    182 import scipy.linalg as linalg
    183 import numpy as np

C:\Program Files\Continuum\Anaconda3\lib\site-packages\scipy\special\__init__.py in <module>()
    544 from __future__ import division, print_function, absolute_import
    545 
--> 546 from ._ufuncs import *
    547 
    548 from .basic import *

ImportError: DLL load failed: The specified module could not be found.

有没有办法绕过这个错误?

【问题讨论】:

  • 找不到什么模块?
  • import seaborn 给我一个错误
  • 嗯,您使用的是import Seaborn 还是import seaborn?第一个对我不起作用,而第二个在 Python 3.6.0 上起作用。 @Ariel
  • 我用的是小写
  • 你运行的是什么 Python 版本?

标签: python matplotlib error-handling seaborn


【解决方案1】:

在我使用 pip 命令卸载并重新安装 scipy 之前,我一直遇到这个问题。刚到你的命令行并输入pip uninstall scipypip install scipy

希望这也对你有用。在此之前我也卸载/安装了 seaborn,虽然我不确定这是否有必要。

使用 conda 而不是 pip 也可以。

【讨论】:

    【解决方案2】:

    为我解决这个问题的是通过 conda 安装 seaborn:

    conda install seaborn
    

    然后重启内核

    【讨论】:

      【解决方案3】:

      问题是因为您使用的是 Windows。 Scipy 与 windows 有问题,如果你检查 sklearn 网站,他们说如果你通过 pipconda 安装他们的包失败,你可以使用非官方的 windows 二进制包安装它们

      所以你需要做的就是这个,在This Linkdownload找到你需要的包吧

      卸载您之前安装的软件包:

      pip uninstall seaborn
      

      从这个链接安装你需要的所有东西,我建议你从这个链接安装numpy , pandas, matplotlib, seaborn , ...

      下载所需的包后,打开你的cmd,进入包含.whl文件的文件夹

      您可以通过以下命令安装它们:

      pip install "seaborn‑0.8.1‑py2.py3‑none‑any.whl"
      

      【讨论】:

        【解决方案4】:

        我遇到了同样的问题。

        我用pip uninstall seaborn 卸载了seaborn,然后我用pip install seaborn 安装了它

        然后它不起作用,所以我重新启动了 KERNEL 并且它起作用了。

        【讨论】:

          【解决方案5】:

          我在使用 Windows 10 时也遇到了同样的问题。将我的 python 版本从 3.7 升级到 3.9 并重新安装所有软件包后,问题就消失了。猜猜它也适用于 python 3.8 但尚未验证。

          更新: 在 Scipy 中找到 cmets:Lib\site-packages\scipy_distributor_init.py:“支持的最低 Python 版本为 3.8”。还验证了 python 3.8 在我的 Windows 10 中工作。

          【讨论】:

          • 这并不能真正回答问题。如果您有其他问题,可以点击 提问。要在此问题有新答案时收到通知,您可以follow this question。一旦你有足够的reputation,你也可以add a bounty 来引起更多的关注。
          猜你喜欢
          • 2020-12-04
          • 1970-01-01
          • 2020-07-02
          • 2020-06-30
          • 2015-12-16
          • 2019-08-06
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多