简体   繁体   English

Matplotlib WSL2 Pycharm

[英]Matplotlib WSL2 Pycharm

I am using the Python 3.8.5 interpreter which is located on WSL2 Ubuntu 20.04.我正在使用位于 WSL2 Ubuntu 20.04 上的 Python 3.8.5 解释器。 The system itself runs on Windows 10. The problem is that matplotlib does not draw a graph.系统本身运行在Windows 10上。问题是matplotlib没有画图。 I use PyCharm as IDE.我使用 PyCharm 作为 IDE。 Tell me please.请告诉我。 how can i solve this problem?我怎么解决这个问题?

import numpy as np
import matplotlib.pyplot as plt
plt.plot(np.array([1,2,3,4,1]))
plt.show()

Unfortunately, this is not yet supported in PyCharm: https://youtrack.jetbrains.com/issue/PY-42827 (and they have no plans yet as to when they're going to fix this).不幸的是,PyCharm: https://youtrack.jetbrains.com/issue/PY-42827尚不支持此功能(他们还没有计划何时修复此问题)。

import matplotlib
matplotlib.use('WebAgg')
import matplotlib.pyplot as plt

This is helpful for me.这对我很有帮助。 It will start a web page in where show the picture.它将启动一个 web 页面,其中显示图片。

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

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