Reputation: 1860
This is my first time to use python. I am using IDE Pyzo and trying to run the following script.
import matplotlib.pyplot as plt
from numpy.random import normal,rand
x = normal(size=200)
plt.hist(x, bins=30)
plt.show()
When I run it line by line from the shell it is working. But when I try to run it from the editor "Run the file as script" it gives the following error:
>>> %cd "c:\program files (x86)\pyzo"
File "<console>", line 1
%cd "c:\program files (x86)\pyzo"
^
SyntaxError: invalid syntax
>>> %run -i "C:\Program Files (x86)\pyzo\Test.py"
File "<console>", line 1
%run -i "C:\Program Files (x86)\pyzo\Test.py"
^
SyntaxError: invalid syntax
Any idea how to run the script without error?
Upvotes: 0
Views: 832
Reputation: 88
Try specifying the two imports on different lines
import matplotlib.pyplot as plt
from numpy.random import normal,rand
Upvotes: 0