安装matplotlib包与安装其他python包没有区别,同样可以使用pip来安装。
启动命令行窗口,在命令行窗口中输入如下命令:(推荐学习:python视频教程)
pip install matplotlib
上面命令将会自动安装 matplotlib 包的最新版本。运行上面命令,可以看到程序先下载 matplotlib 包,然后提示 matplotlib 包安装成功:
installing collected packages: matplotlibsuccessfully installed matplotlib-2.2.3
如果在命令行窗口中提示找不到 pip 命令,则也可以通过 python 命令运行 pip 模块来安装 matplotlib 包。
例如,通过如下命令来安装 matplotlib 包:
python -m pip install matplotlib
在成功安装 matplotlib 包之后,可以通过 pydoc 来查看 matplotlib 包的文挡。在命令行窗口中输入如下命令:
python -m pydoc -p 8899
运行上面命令之后,打开浏览器查看 http://localhost:8899/ 页面,可以在 python 安装目录的 lib\site-packages 下看到 matplotlib 包的文档,如图所示。
更多python相关技术文章,请访问python教程栏目进行学习!
以上就是python如何安装matplotlib的详细内容。
