我正在尝试按照 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/