Python 无法以root用户身份运行PyCharm解释器

Python 无法以root用户身份运行PyCharm解释器,python,kubernetes,pycharm,interpreter,Python,Kubernetes,Pycharm,Interpreter,我正在尝试使用。 我尝试运行以下代码: from kubernetes import client, config # Configs can be set in Configuration class directly or using helper utility config.load_kube_config() v1 = client.CoreV1Api() print("Listing pods with their IPs:") ret = v1.list_pod_for_all

我正在尝试使用。 我尝试运行以下代码:

from kubernetes import client, config

# Configs can be set in Configuration class directly or using helper utility
config.load_kube_config()

v1 = client.CoreV1Api()
print("Listing pods with their IPs:")
ret = v1.list_pod_for_all_namespaces(watch=False)
它失败了,错误很多。 当我在shell中使用python运行相同的代码时,同样的问题也会出现。 当我在shell中使用sudopython运行相同的代码时,它是有效的

我正在尝试以root身份运行PyCharm interperte。 根据JetBrains的介绍,我创建了一个名为pythonCustomInt.sh的脚本shell,其中包含:

sudo python
我转到PyCharm设置>项目解释器并将基本解释器更改为//pythonCutomInt.sh,但它写入了一个错误:

环境位置目录不为空

我不确定我需要把剧本放在哪里。
有什么想法吗

我运行了sudo-s,然后从pycharm文件夹pycharm-community-2018.1.4/bin运行了sh./pycharm.sh,它成功了

我建议解决核心问题。可能您已经以root用户身份运行了客户端,并且在以普通用户身份运行客户端时,它留下了一些无法读取的缓存/配置文件。洛杉矶来帮忙。可能系统上非root用户的套接字被阻止了,但这种情况不太可能发生。如果这些想法没有帮助,那么制作一个运行sudopythonmyscript的shell脚本,并使用BashSupport插件运行它。不过,您将无法附加调试器。