gpt4 book ai didi

python - XDG_RUNTIME_DIR 指向不存在的路径

转载 作者:行者123 更新时间:2023-11-30 21:57:33 33 4
gpt4 key购买 nike

我正在尝试在 pycharm 中按照以下代码生成一个简单的 matplotlib 图形。

import matplotlib.pyplot as plt
import numpy as np


x = np.linspace(0, 5, 11)
y = x ** 2


fig = plt.figure()
axes1 = fig.add_axes([0.1,0.1,0.8,0.8])
axes2 = fig.add_axes([0.2,0.5,0.4,0.3])

axes1.plot(x,y)
axes2.plot(y,x)

axes1.set_xlabel('X_1 label')
axes1.set_ylabel('Y_1 label')
axes1.set_title('Title_1')

axes2.set_xlabel('X_2 label')
axes2.set_ylabel('Y_2 label')
axes2.set_title('Title_2')

我收到错误

/home/lk/anaconda3/envs/pycharm/bin/python "/home/lk/Desktop/Python Exps/pycharm/tr.py"
QStandardPaths: XDG_RUNTIME_DIR points to non-existing path '/run/user/1000/snap.pycharm-community', please create it with 0700 permissions.

Process finished with exit code 0

此错误的含义是什么以及如何解决它?

最佳答案

只需使用以下命令创建一个目录:

$ mkdir -p /run/user/1000/snap.pycharm-community

并像这样更改其权限:

$ chmod 0700 /run/user/1000/snap.pycharm-community

或者,您可以设置环境变量XDG_RUNTIME_DIR:

$ export XDG_RUNTIME_DIR=/your/dir

Source and more information on the topic

关于python - XDG_RUNTIME_DIR 指向不存在的路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55210561/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com