官术网_书友最值得收藏!

Importing modules through the Python interpreter

If you are importing any module, then the Python interpreter checks if that module is available or not. You can do this by using the import statement. If that module is available, then you will see the >>> prefix after pressing the Enter key. This indicates that the execution was successful. If that module doesn't exist, the Python interpreter will show an error:

>>> import time
>>>

After importing the time module, we get the >>> prefix. This means that the module exists and this command gets executed successfully:

>>> import matplotlib

If the module doesn't exist, then you will get Traceback error:

File "<stdin>", line 1, in <module>
ImportError: No module named 'matplotlib'

So here, matplotlib isn't available, so it gives an error: ImportError: No module named 'matplotlib'.

To solve this error, we will have to install matplotlib and then again try to import matplotlib. After installing matplotlib, you should be able to import the module, as follows:

>>> import matplotlib
>>>
主站蜘蛛池模板: 安义县| 吉木乃县| 肃北| 贡觉县| 龙山县| 衡水市| 班戈县| 白城市| 拜泉县| 剑川县| 岗巴县| 合山市| 沾化县| 二连浩特市| 桐庐县| 姜堰市| 革吉县| 宁安市| 中卫市| 萍乡市| 瑞丽市| 正安县| 伊春市| 宽城| 阳谷县| 雷波县| 西宁市| 遂平县| 皋兰县| 上栗县| 交城县| 定襄县| 萨迦县| 体育| 龙山县| 琼中| 铜陵市| 锡林郭勒盟| 瓦房店市| 洪泽县| 兴安盟|