0

How to fix AttributeError in python

Python keeps bringing AttributeError: module 'numpy' has no attribute 'array' whenever I run 'np.array(lst)' through the .py file but works fine at the interpreter shell. How do I fix this pls?

8th Jan 2021, 2:59 PM
Neutral ◼️◾▪️
Neutral ◼️◾▪️ - avatar
5 Respostas
+ 1
maybe you have a file called numpy.py in your working directory.
8th Jan 2021, 3:26 PM
The future is now thanks to science
The future is now thanks to science - avatar
+ 2
The future is now thanks to science it seems thats the case cos I remember naming the file 'numpy.py' --bad move
8th Jan 2021, 5:22 PM
Neutral ◼️◾▪️
Neutral ◼️◾▪️ - avatar
+ 2
Finally fix by renaming the code file something other than 'numpy.py'
8th Jan 2021, 7:17 PM
Neutral ◼️◾▪️
Neutral ◼️◾▪️ - avatar
+ 1
What do you mean by "run through the .py file"? Do you mean executing the script? Were you able to fix it?
8th Jan 2021, 4:54 PM
Lisa
Lisa - avatar
0
Lisa by that I meant that run it directly through the built-in editor and not thru the interpreter and No I couldn't fix it
8th Jan 2021, 5:21 PM
Neutral ◼️◾▪️
Neutral ◼️◾▪️ - avatar