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

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

 

 

 

 

解决方案:

pip uninstall numpy

pip install numpy==1.23.4

 =============================================

Since version 1.24 of numpy, np.object is deprecated, and needs to be replaced with object (cf. numpy release notes).

You either need to update this in your code, or another package you're using needs to be updated (not possible to answer without more information).

One (dirty) workaround for now would be to fix your numpy version to the last version still supporting np.object with pip install numpy==1.23.4

=============================================

The Python "AttributeError module 'numpy' has no attribute 'object'" occurs when we have a local file named numpy.py and try to import it from the numpy module. To solve the error, make sure to rename any local files named numpy.py . Another way: Check that the file you are running was named numpy.py

=============================================

  • Solution 1: pip install --upgrade numpy

  • Solution 2: Re-install numpy

      pip uninstall numpy
      pip install numpy
    
  • Solution 3 (if you are using conda package manager): conda update numpy

=============================================

 

 

 

https://stackoverflow.com/questions/75069062/module-numpy-has-no-attribute-object#:~:text=The%20Python%20%22AttributeError%20module%20'numpy,running%20was%20named%20numpy.py%20.

 

posted @ 2023-01-30 12:21  emanlee  阅读(19460)  评论(0编辑  收藏  举报