我有Windows 7操作系统。
在安装matplotlib(通过pip)时,f2tfont.cpp由于某种原因无法编译,因此matplotlib安装失败。同时,matplotlib installer找不到Python安装文件。
请参见here的评论以获取更多问题细节。
以下命令对我有用。我认为问题出在新的matplotlib版本3.3.1上。我将其降级到matplotlib 3.0.3。
我卸载了较新的版本,然后重新打开命令提示符并安装了matplotlib 3.0.3。它对我起作用了。我不确定它是否适用于您,因此建议查看讨论。
pip uninstall matplotlib
pip install matplotlib==3.0.3
这解决了我的问题。
在 matplotlib 3.1.1
发布之前的一个解决方法是,您可以使用以下命令安装此软件包 msvc-runtime
:
pip install msvc-runtime
我在Windows 10上使用Anaconda命令提示符,这种方法对我有效:
pip uninstall matplotlib
pip install --upgrade matplotlib
pip install matplotlib==3.2.1
您需要在您的系统中安装Visual Studio C++。
安装带有C++发行版的Visual Studio 2019。
这对我来说运行得非常完美。
我曾经遇到过这个问题,然后卸载并重新安装了conda,并通过conda更新了所有的包。但是问题仍然存在。接着我使用conda卸载了有问题的包(在我的情况下,这个错误出现在matplotlib和h5py两个包中),然后使用pip重新安装它们。这似乎解决了问题。奇怪的是,它只会在控制台中给出这个错误。当在Jupyter笔记本中运行时,我没有看到这个错误。可能是IPython和Python之间的一些差异。
import matplotlib.pyplot as plt
。
import matplotlib ImportError: DLL load failed: The specified procedure could not be found
pip
安装matplotlib和numpy,但对于所有其他依赖项,请使用它。随着matplotlib的发布,这种情况可能会改变。>>> matplotlib.__version__
'1.3.1'
>>> from matplotlib import ft2font
>>>
matplotlib
。我知道这不是安装程序的问题,因为我在另一台计算机上使用了相同的安装程序,一切都正常工作。你会建议我如何修复我的安装失败? - bzm3r以上的解决方案都没有对我起作用!尝试这个:
pip uninstall matplotlib
pip install -U matplotlib==3.2.0rc1