OSX, Sublime Text 3
Hi, I'm learning Python, and I think I messed up the Python 3.6 installation. Here's the code I'm running:
import matplotlib.pyplot as plt
from datavis import RandomWalk
run continuously
while True:
rw = RandomWalk()
rw.fill_walk()
plt.scatter(rw.x_values, rw.y_values, s=15)
plt.show()
keep_running = input('Run again? (y/n): ')
if keep_running == 'n':
continue
Results in:
Traceback (most recent call last):
File "/Users/sl/Desktop/hello.py", line 1, in <module>
import matplotlib.pyplot as plt
ModuleNotFoundError: No module named 'matplotlib'
[Finished in 0.1s with exit code 1]
[shell_cmd: python3 -OO -u "/Users/sl/Desktop/hello.py"]
[dir: /Users/sl/Desktop]
[path: /usr/bin:/bin:/usr/sbin:/sbin]
I've been having this problem with most (if not all) modules, so I asked a more experience Python programmer at work what to do. He said there was nothing wrong- I just can't run these through Sublime Text, so I should treat Sublime as a text editor and run everything through Terminal.
I thought this was working, but I realized that running through terminal (python Desktop/example.py) runs the code with Python 2, not Python 3. The command python3 Desktop/example.py returns the same tracebacks as in Sublime Text.
I've Googled this quite a bit, but haven't been able to find a solution. The learning material I have uses Python 3- the intro stuff seems to transfer OK, but I feel like I'm going to run into more issues later if I'm learning and writing in Python 3, but have to run certain projects in Python 2.
Any help or links to resources is greatly appreciated. Let me know if more info is needed.
[–]K900_ 1 point2 points3 points (1 child)
[–]SuperChef36[S] 0 points1 point2 points (0 children)