【问题标题】:Matplotlib not showing plot when program is executed in the VS Code terminal在 VS Code 终端中执行程序时,Matplotlib 不显示绘图
【发布时间】:2021-03-21 19:33:11
【问题描述】:

我这里有这个简单的程序

import numpy as np 
import matplotlib.pyplot as plt 

num_of_intervals = 2000
x = np.linspace(-10,10,num=num_of_intervals)

y_inputs = 1/(1+np.exp(-x)) # SIGMOID FUNCTION

plt.figure(figsize = (15,9))
plt.plot(x,y_inputs,label = 'Sigmoid Function')
plt.vlines(x=0, ymin = min(y_inputs), ymax=max(y_inputs), linestyles='dashed')
plt.title('Sigmoid Function')
plt.show()

当上述程序在 vscode 终端中运行时。看不到情节(通常会出现一个显示情节的弹出窗口)。

但是当程序在Ubuntu终端运行时,情节可以看作是一个弹窗。

知道如何用 vscode 解决这个问题。

操作系统:Ubuntu 20.04

Visual Studio 代码 1.54.3

Python:3.8.5

【问题讨论】:

    标签: python matplotlib ubuntu visual-studio-code vscode-settings


    【解决方案1】:

    仔细检查此选项是否已在“设置”中打开:terminal.integrated.inheritEnv

    【讨论】:

    • 非常感谢...现在一切正常
    猜你喜欢
    • 2021-05-13
    • 2020-08-28
    • 2021-11-01
    • 2021-05-26
    • 2019-12-19
    • 2019-03-27
    • 1970-01-01
    • 1970-01-01
    • 2016-07-16
    相关资源
    最近更新 更多