简体   繁体   中英

Matplotlib WSL2 Pycharm

I am using the Python 3.8.5 interpreter which is located on WSL2 Ubuntu 20.04. The system itself runs on Windows 10. The problem is that matplotlib does not draw a graph. I use PyCharm as 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).

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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