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

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
>>>
主站蜘蛛池模板: 宁强县| 奎屯市| 彰武县| 丁青县| 枝江市| 株洲市| 贞丰县| 铁力市| 措美县| 铁力市| 土默特右旗| 呼伦贝尔市| 北碚区| 兴安盟| 长海县| 宜君县| 察哈| 广州市| 安仁县| 达州市| 五华县| 潮安县| 永兴县| 茂名市| 舟山市| 手机| 香港| 遂川县| 武宁县| 文水县| 卢湾区| 万山特区| 拜泉县| 乳山市| 五峰| 迭部县| 正定县| 原阳县| 茂名市| 孝感市| 额敏县|