AttributeError: module 'numpy' has no attribute 'array' solution

When some students write pyhton programs, the following errors will occur:

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

This means that the array attribute is not found in the numpy file: this is because when we beginners name the file, sometimes in order to facilitate the search of the file later, the file name will be named as the name of the third-party library used in the code .

Then when the code is compiled, it will read the program you wrote and execute it, and find that there are no relevant attributes, and then report an error.

After the principle is explained clearly, we can modify it. Find the program we wrote ourselves and find the .py file with the same name. For example, we are looking for the numpy.py file here.

Once found, we can choose to delete or rename. Then we execute it again, and the problem is solved.
insert image description here
Here, there is another problem that needs to be explained, that is, if we update the editor, then we first update the third-party library used, because some editors may not be compatible.

Guess you like

Origin blog.csdn.net/m0_66106755/article/details/128745362