I try to run a script through TextWrangler

I have Python 3.6 installed on my Mac OS X. When I wrote my script I wrote the following

import datetime as dt
import matplotlib.pyplot as plt
from matplotlib import style
import pandas as pd
import pandas_datareader.data as web

but then when I run it, I get the following error message:

Traceback (most recent call last): File "/Users/YoavPoni/Documents/Python/TextWranglerRunTemp-sen.py‌​", line 4, in import matplotlib.pyplot as plt ModuleNotFoundError: No module named 'matplotlib'

Any suggestions?


You might need to change the Python you are invoking when running the program. Currently, you may be using the standard Python that comes from Mac OS X (that does not have matplotlib installed). What you need to do is run your code with the Python that has matplotlib installed in its library.

You should include a line at the beginning of your Python code like

#!/usr/bin/env python

With /usr/bin/env being the full path to the Python interpreter with matplotlib installed.

链接地址: http://www.djcxy.com/p/46724.html

上一篇: Anaconda安装的MATPLOTLIB未被IDLE SHELL识别

下一篇: 我尝试通过TextWrangler运行脚本