22
votes

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.

1

1 Answers

92
votes

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.