简体   繁体   English

Tensorflow Jupyter 笔记本中的 Matplotlib

[英]Matplotlib in Tensorflow Jupyter Notebook

In Anaconda Navigator, I switched to running applications on tensorflow and installed jupyter 5.6.0.在 Anaconda Navigator 中,我切换到在 tensorflow 上运行应用程序并安装了 jupyter 5.6.0。 I then open up a Python3 notebook.然后我打开一个 Python3 笔记本。 I then import tensorflow, keras and numpy without issue.然后我毫无问题地导入 tensorflow、keras 和 numpy。 Then when I try to import matplotlib, the notebook says ImportError: No module named 'matplotlib'.然后,当我尝试导入 matplotlib 时,笔记本显示 ImportError: No module named 'matplotlib'。

I tried running the following command in my anaconda prompt in both base and after activating tensorflow: pip3 install matplotlib我尝试在我的 anaconda 提示符中和激活 tensorflow 后运行以下命令: pip3 install matplotlib

And it says:它说:

(tensorflow) C:\Users\danie>pip3 install matplotlib Requirement already satisfied (tensorflow) C:\Users\danie>pip3 install matplotlib 要求已经满足

for 7 different lines.适用于 7 条不同的线路。 What am I doing wrong?我究竟做错了什么?

Add import sys and sys.executable to the top of your notebook, then run it. import syssys.executable添加到笔记本顶部,然后运行它。 This shows you the directory of the running kernel. 这将显示正在运行的内核的目录。 With this information, from a new command-line ( not a Python console) run C:\\path\\to\\python.exe -m pip install matplotlib 有了这些信息,就可以从新的命令行( 不是 Python控制台)运行C:\\path\\to\\python.exe -m pip install matplotlib

, pip install matplotlib ,worked perfect for me in the tensorflow environment (Jupyter) , pip 安装 matplotlib ,在 tensorflow 环境(Jupyter)中非常适合我

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM