Reputation: 1
I want to run a python example:
#!/usr/bin/python
import numpy as np
import matplotlib.pyplot as plt
x=[2,3,4,5,7,9,13,15,17]
plt.plot(x)
plt.ylabel('Sunlight')
plt.xlabel('Time')
plt.show()
When I' try to run: python plot.py in my Ubuntu 16.04LTS terminal, I get this output: ImportError: No Module named 'numpy'. I have installed numpy by running this command: sudo apt-get install python3-numpy. I'm using Python 3.5. How can I make Ubuntu/Python in order to import numpy module?
Upvotes: 0
Views: 1286
Reputation: 11177
You must exec python3 plot.py
.
Or if you want to run python
(that is, python2), you must install python-numpy
.
Note that you can also exec you script direct:
$ chmod +x plot.py
$ ./ploy.py
to use python3
change the first line to
#!/usr/bin/python3
Upvotes: 2