AttributeError:模块"numpy"没有属性"core" [英] AttributeError: module 'numpy' has no attribute 'core'

查看:1640
本文介绍了AttributeError:模块"numpy"没有属性"core"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有人在运行spark并尝试导入numpy时遇到此问题. Numpy在标准笔记本中正确导入,但是当我尝试通过运行spark的笔记本导入它时,出现此错误.我拥有numpy的最新版本,并且正在运行最新的anaconda python 3.6.

I was wondering if anyone had this issue when running spark and trying to import numpy. Numpy imports properly in a standard notebook, but when I try importing it via a notebook running spark, I get this error. I have the most recent version of numpy and am running the most recent anaconda python 3.6.

谢谢!


---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
 in ()
----> 1 import numpy

/Users/michaelthomas/anaconda/lib/python3.6/site-packages/numpy/__init__.py in ()
    144         return loader(*packages, **options)
    145 
--> 146     from . import add_newdocs
    147     __all__ = ['add_newdocs',
    148                'ModuleDeprecationWarning',

/Users/michaelthomas/anaconda/lib/python3.6/site-packages/numpy/add_newdocs.py in ()
     11 from __future__ import division, absolute_import, print_function
     12 
---> 13 from numpy.lib import add_newdoc
     14 
     15 ###############################################################################

/Users/michaelthomas/anaconda/lib/python3.6/site-packages/numpy/lib/__init__.py in ()
      6 from numpy.version import version as __version__
      7 
----> 8 from .type_check import *
      9 from .index_tricks import *
     10 from .function_base import *

/Users/michaelthomas/anaconda/lib/python3.6/site-packages/numpy/lib/type_check.py in ()
      9            'common_type']
     10 
---> 11 import numpy.core.numeric as _nx
     12 from numpy.core.numeric import asarray, asanyarray, array, isnan, \
     13                 obj2sctype, zeros

AttributeError: module 'numpy' has no attribute 'core'

推荐答案

我遇到了同样的问题,我尝试使用pip升级numpy软件包,此问题已解决.

I was having the same issue and I tried upgrading the numpy package using pip and it has got resolved.

pip install --upgrade numpy


(base) C:\Users\Mohanavelu>pip install --upgrade numpy

Collecting numpy
  Downloading https://files.pythonhosted.org/packages/53/d1/2499797c88de95ea3239ad7f6e6a47895fe51aad1aa2a116f50ec9e0ee74/numpy-1.15.0-cp36-none-win_amd64.whl (13.5MB)
    100% |████████████████████████████████| 13.5MB 1.6MB/s
Installing collected packages: numpy
  Found existing installation: numpy 1.14.0
    Uninstalling numpy-1.14.0:
      Successfully uninstalled numpy-1.14.0
Successfully installed numpy-1.15.0

这篇关于AttributeError:模块"numpy"没有属性"core"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆