小编mel*_*vio的帖子

UserWarning:FigureCanvasAgg 是非交互式的,因此无法显示 plt.show()

我在用

  • Windows 10
  • PyCharm 2021.3.3 专业版
  • 蟒蛇3.11.5
  • matplotlib 3.8.1

如何在我的开发环境中永久解决此问题?

import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt

# Read data from file, skipping the first row (header)
data = np.loadtxt('cm.dat', skiprows=1)

# Initialize reference point
x0, y0, z0 = data[0]

# Compute squared displacement for each time step
SD = [(x - x0)**2 + (y - y0)**2 + (z - z0)**2 for x, y, z in data]

# Compute the cumulative average of SD to get …
Run Code Online (Sandbox Code Playgroud)

python matplotlib pycharm

11
推荐指数
1
解决办法
2万
查看次数

How to automatically toggle the Dark Reader Chrome plugin?

Question

How can we automatically toggle Dark Mode at predetermined times?

Background

Every day, around 5 PM, I switch on the dark mode of the Dark Reader Chrome extension. I toggle it off again the next morning to get more bright light in the morning.

As of now, I have remind myself everyday to hit the <Alt>+<Shift>+<D>-shortcut that I have configured in Google Chrome (chrome://extensions/shortcuts): 在此输入图像描述

browser google-chrome browser-automation google-chrome-extension darkmode

8
推荐指数
1
解决办法
2768
查看次数

GitHub Actions:pylint 失败并显示 F0001:没有名为 __init__.py 的模块(致命)

以下 GitHub Pylint 入门工作流程失败并出现大量pylintF0001 错误。

这是 github-workflow源代码:

name: Pylint

on: [push]

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v2
    - name: Set up Python 3.9
      uses: actions/setup-python@v2
      with:
        python-version: 3.9
    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        pip install pylint
    - name: Analysing the code with pylint
      run: |
        pylint `ls -R|grep .py$|xargs`
Run Code Online (Sandbox Code Playgroud)

这些是工作流程输出的错误:

Run pylint $(ls -R | grep '.py$' | xargs)
************* Module __init__.py
__init__.py:1:0: F0001: No module named __init__.py …
Run Code Online (Sandbox Code Playgroud)

grep github pylint python-3.x github-actions

5
推荐指数
1
解决办法
5275
查看次数