[英]from matplotlib import ft2font: “ImportError: DLL load failed: The specified procedure could not be found.”
I have Windows 7.我有 Windows 7。
For some reason, f2tfont.cpp does not compile when installing matplotlib (through pip
), hence, the matplotlib install fails.出于某种原因, f2tfont.cpp 在安装 matplotlib (通过
pip
)时不会编译,因此,matplotlib 安装失败。 Also, the matplotlib installer cannot find a Python installation.此外, matplotlib 安装程序找不到 Python 安装。
See comments here for further details on the problem.有关该问题的更多详细信息,请参阅此处的评论。
These following commands worked for me.以下这些命令对我有用。 I think problem is with the new matplotlib version 3.3.1.
我认为问题在于新的 matplotlib 版本 3.3.1。 I downgraded to matplotlib 3.0.3.
我降级到 matplotlib 3.0.3。
I uninstalled the newer version, then reopen command prompt and installed matplotlib 3.0.3.我卸载了较新的版本,然后重新打开命令提示符并安装了 matplotlib 3.0.3。 It's worked for me.
它对我有用。 I am not sure if it will work for you, so I recommend to check out the discussion .
我不确定它是否适合你,所以我建议查看讨论。
pip uninstall matplotlib
pip install matplotlib==3.0.3
This solves my problem这解决了我的问题
As a workaround until matplotlib 3.1.1
is released, you could install this package msvc-runtime
using the following command:作为
matplotlib 3.1.1
发布之前的解决方法,您可以使用以下命令安装此包msvc-runtime
:
pip install msvc-runtime
This worked for me on Windows 10 (using the Anaconda prompt):这在 Windows 10 上对我有用(使用 Anaconda 提示):
pip uninstall matplotlib
pip install --upgrade matplotlib
As specified in PEP 11, a Python release only supports a Windows platform while Microsoft considers the platform under extended support.
根据 PEP 11 的规定,Python 版本仅支持 Windows 平台,而 Microsoft 认为该平台处于扩展支持之下。 This means that Python 3.7 supports Windows Vista and newer.
这意味着 Python 3.7 支持 Windows Vista 和更新版本。 If you require Windows XP support then please install Python 3.4.
如果您需要 Windows XP 支持,请安装 Python 3.4。
In case Windows Service Pack isn't installed.如果未安装 Windows Service Pack。 You can download Windows 7 Service Pack 1 (SP1) manually from here or also you can download it from Windows Update of Windows 7.
您可以从这里手动下载Windows 7 Service Pack 1 (SP1) ,也可以从 Windows 7 的Windows Update下载。
So, you need to install Microsoft Visual C++ redistribution 2015 from here .因此,您需要从 此处安装Microsoft Visual C++ redistribution 2015 。
You don't need to install Microsoft Visual Studio just C++ redistributions of 2015 will do the job.您不需要安装 Microsoft Visual Studio,只需 2015 年的 C++ 重新分发即可完成这项工作。
You need to have Visual Studio c++ in Your System.您的系统中需要有 Visual Studio c++。
Install Visual Studio 2019 with c++ distributions .使用 c++ 发行版安装 Visual Studio 2019。
It worked perfectly for me.它非常适合我。
这在 Windows 10 上对我有用:
pip install matplotlib==3.2.1
If you get this error by just importing matplotlib, you probably have a botched matplotlib installation.如果仅通过导入 matplotlib 就出现此错误,则您可能安装了一个拙劣的 matplotlib。 Did you compile it yourself (which I find very hard to do) or did you use a binary installer from the official page (which works like a charm, as long as you installed the dependencies beforehand)?
您是自己编译的(我觉得很难做到)还是使用了官方页面上的二进制安装程序(只要您事先安装了依赖项,它就像一个魅力一样)?
DO NOT USE pip
for installing matplotlib and numpy, but use it for all other dependencies.不要使用
pip
安装 matplotlib 和 numpy,而是将它用于所有其他依赖项。 This may change in the future as soon as wheels arecoming out for matplotlib.一旦出现 matplotlib 的轮子,这可能会在未来改变。
Python console output on a Windows box: Windows 机器上的 Python 控制台输出:
>>> matplotlib.__version__
'1.3.1'
>>> from matplotlib import ft2font
>>>
I had this issue and then uninstalled and reinstalled conda, and updated all packages through conda.我遇到了这个问题,然后卸载并重新安装了 conda,并通过 conda 更新了所有软件包。 But the issue persisted.
但问题依然存在。 I then did a conda uninstall of the offending package (in my case, this error appeared for both matplotlib and h5py), and then pip installed them.
然后我对有问题的包进行了 conda 卸载(在我的情况下,matplotlib 和 h5py 都出现了这个错误),然后 pip 安装了它们。 This seemed to have fixed the issue.
这似乎解决了这个问题。 Strangely, it would only give this error through the console.
奇怪的是,它只会通过控制台给出这个错误。 When run through a Jupyter notebook, I didn't see this error.
通过 Jupyter 笔记本运行时,我没有看到此错误。 Must be some difference between IPython and python.
IPython和python之间一定有一些区别。
None of above solutions worked for me!以上解决方案都不适合我! Try this:
试试这个:
pip uninstall matplotlib
pip install -U matplotlib==3.2.0rc1
I am running windows 7 with Python version 3.7.1 and Pip version 19.1.1我正在使用 Python 版本 3.7.1 和 Pip 版本 19.1.1 运行 Windows 7
I needed to install Microsoft visual studio.我需要安装 Microsoft Visual Studio。 Microsoft visual studio is needed for the kiwisolver that is installed with
matplotlib
using pip.使用 pip 与
matplotlib
安装的 kiwisolver 需要 Microsoft Visual Studio。 It is free but a 4MB download took over one to two hours to get on my machine and installed.它是免费的,但 4MB 的下载需要一到两个小时才能进入我的机器并安装。
After using pip to install matplotlib
, but without visual studio on my machine, running my script with使用 pip 安装
matplotlib
,但我的机器上没有visual studio,运行我的脚本
import matplotlib.pyplot as plt
the error I had was:我的错误是:
import matplotlib ImportError: DLL load failed: The specified procedure could not be found
After installing visual studio everything worked great!安装visual studio后一切都很好!
Get Microsoft visual studio here . 在此处获取 Microsoft Visual Studio。
如果每次尝试通过 jupyter 在你的电脑上安装 matplotlib 时都遇到错误,只需下载 ccleaner,然后在安装后单击健康检查图标,然后自定义清理以检查导致问题的重复文件,然后返回通过输入pip install matplotlib
通过 anaconda 命令提示符pip install matplotlib
对我来说,我通过卸载 python 3.8 并安装了 python 3.5 解决了这个问题
只需安装“Microsoft Visual C++ Redistributable”
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.