24

I am just trying to convert a list to a 1D array like so:

import numpy as np

print np.array([2, 3, 4])

But I get the following error:

Traceback (most recent call last):
  File "numpy.py", line 11, in <module>
    test_run()
  File "numpy.py", line 8, in test_run
    print np.array([2, 3, 4])
AttributeError: 'module' object has no attribute 'array'

I tried reinstalling numpy because that seems to have worked for others, but this does not fix the problem.

The Nightman
  • 5,417
  • 8
  • 35
  • 66

1 Answers1

104

You are most likely having a file called numpy.py in your working directory which shadows the real numpy module. Rename that file and remove its numpy.pyc file.

timgeb
  • 73,231
  • 20
  • 109
  • 138