Numpy import throws AttributeError: 'module' object has no attribute 'core'

后端 未结 5 1748
清歌不尽
清歌不尽 2020-12-10 16:28
import numpy as np
  File \"/home/anirrudh/.virtualenvs/ml4t2/local/lib/python2.7/site-packages/numpy/__init__.py\", line 180, in 
    from . import ad         


        
相关标签:
5条回答
  • 2020-12-10 16:48

    This happened to me in Windows with Anaconda. I fixed it by removing the python3 path from the environment variable PATH.

    0 讨论(0)
  • 2020-12-10 16:53

    (Answer posted on behalf of the OP).

    Update: Resolved.

    I had created a python file for one of my projects name random.py and when numpy is imported, it was calling this file instead of it's own library file hence resulting in the error. I had to delete/rename random.py which I created and that fixed the issue.

    0 讨论(0)
  • 2020-12-10 16:57

    It happened to me in a specific ipynb, once I crated a copy of the notebook with a different name I was able to import numpy.

    0 讨论(0)
  • 2020-12-10 17:03

    Try running it in Python 2 instead of Python 3 - you may have the older version of Spark

    0 讨论(0)
  • 2020-12-10 17:05

    Another common problem here (which I had)...check to make sure you dont have a PYTHONPATH env var pointing to a different version of python site-packages (this happened because I updated my python version and didn't change this...it loads from PYTHONPATH first).

    0 讨论(0)
提交回复
热议问题