当前位置:  开发笔记 > 编程语言 > 正文

numpy.core.multiarray无法导入

如何解决《numpy.core.multiarray无法导入》经验,为你挑选了1个好方法。

我使用以下命令来了解我正在使用的numpy版本

pip show numpy

输出如下所示

---
Name: numpy
Version: 1.8.2
Location: /usr/lib/python2.7/dist-packages
Requires: 

但是,当我运行matplotlib时,我收到了一个错误

RuntimeError: module compiled against API version a but this version of numpy is 9
        from matplotlib import pyplot as plt
      File "/usr/local/lib/python2.7/dist-packages/matplotlib/pyplot.py", line 27, in 
        import matplotlib.colorbar
      File "/usr/local/lib/python2.7/dist-packages/matplotlib/colorbar.py", line 32, in 
        import matplotlib.artist as martist
      File "/usr/local/lib/python2.7/dist-packages/matplotlib/artist.py", line 12, in 
        from .transforms import Bbox, IdentityTransform, TransformedBbox, \
      File "/usr/local/lib/python2.7/dist-packages/matplotlib/transforms.py", line 39, in 
        from matplotlib._path import (affine_transform, count_bboxes_overlapping_bbox,

我试着升级numpy,

pip install numpy --upgrade

它显示安装成功,但numpy仍然显示为1.8.2并且在运行matplotlib时仍然存在错误.

我想卸载numpy并重新安装它,系统给出了消息说

Not uninstalling numpy at /usr/lib/python2.7/dist-packages, owned by OS

怎么解决?任何想法

RuntimeError:针对API版本a编译的模块,但此版本的numpy为9

小智.. 12

我如何升级numpy?可能会为你工作.在那种情况下,这是一个路径问题:

RuntimeError: module compiled against API version 9 but this version of numpy is 6
Traceback (most recent call last):
  File "", line 1, in 
ImportError: numpy.core.multiarray failed to import 

解:

检查路径

import numpy
print numpy.__path__

并使用rm手动删除它



1> 小智..:

我如何升级numpy?可能会为你工作.在那种情况下,这是一个路径问题:

RuntimeError: module compiled against API version 9 but this version of numpy is 6
Traceback (most recent call last):
  File "", line 1, in 
ImportError: numpy.core.multiarray failed to import 

解:

检查路径

import numpy
print numpy.__path__

并使用rm手动删除它

推荐阅读
jerry613
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有