Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to run numpy
#1
I created a file nmpy.py following exactly given the code in the numpy tutorial -
https://docs.scipy.org/doc/numpy/user/quickstart.html

The contents of nmpy.py are the following:

import numpy as np
a = np.array([2,3,4])
When I run the script

python nmpy.py

I get the following problem:

Error:
Traceback (most recent call last): File "nmpy.py", line 1, in <module> import numpy as np File "/home/v/numpy.py", line 2, in <module> AttributeError: 'module' object has no attribute 'array'
What is wrong?
Reply
#2
What is your current working directory? Does working directory contain a file named numpy.py? If so, remove it from your current directory.
Reply
#3
That seemed to be the issue
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [Numpy] How to store different data type in one numpy array? water 7 625 Mar-26-2024, 02:18 PM
Last Post: snippsat
  Numpy returns "TypeError: unsupported operand type(s) for *: 'numpy.ufunc' and 'int'" kalle 2 2,642 Jul-19-2022, 06:31 AM
Last Post: paul18fr
  "erlarge" a numpy-matrix to numpy-array PhysChem 2 3,007 Apr-09-2019, 04:54 PM
Last Post: PhysChem

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020