简体   繁体   中英

Can't run PyCharm interpreter as root

I am trying to use Kubernetes python SDK .
I tried to run the following code:

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)

It failed with lots of errors.
When I run the same code with python from a shell, the same issue.
When I run the same code with sudo python from shell, it works.

I am trying to run PyCharm interperte as root.
Following the instruction from JetBrains, I created a script shell with the name pythonCustomInt.sh that contains:

sudo python

I went to PyCharm settings > Project Interpreter and changed the Base interpreter to /<path>/pythonCutomInt.sh but it writes an error:

Environment location directory is not empty

在此处输入图片说明 I am not sure where I need to put the script.
Any idea?

我运行sudo -s ,然后从pycharm文件夹( pycharm-community-2018.1.4/bin )中运行sh ./pycharm.sh并成功运行。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM