PyCharm 权限错误
PyCharm PermissionError
pycharm 权限有点问题。我想 运行 我的脚本,但随后出现权限错误。我使用包 pythonping 来 ping 一个代理地址。我可以 运行 使用 sudo 命令在 MacOS 的终端上运行脚本,但我想 运行 PyCharm.
中的所有内容
代码如下:
import pythonping
pythonping.ping('47.241.107.35', verbose=True)
这是输出:
Traceback (most recent call last):
File "/Users/dominik/Documents/Pycharm Projects on MacOS/venv/scripts/test_pythonping.py", line 3, in <module>
pythonping.ping('47.241.107.35', verbose=True)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pythonping/__init__.py", line 73, in ping
comm = executor.Communicator(target, provider, timeout, socket_options=options, verbose=verbose, output=out,
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pythonping/executor.py", line 247, in __init__
self.socket = network.Socket(target, 'icmp', source=None, options=socket_options)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pythonping/network.py", line 33, in __init__
self.socket = socket.socket(socket.AF_INET, socket.SOCK_RAW, self.protocol)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/socket.py", line 232, in __init__
_socket.socket.__init__(self, family, type, proto, fileno)
PermissionError: [Errno 1] Operation not permitted
您可以 运行 PyCharm 作为管理员,然后所有脚本将 运行 具有管理员权限。
pycharm 权限有点问题。我想 运行 我的脚本,但随后出现权限错误。我使用包 pythonping 来 ping 一个代理地址。我可以 运行 使用 sudo 命令在 MacOS 的终端上运行脚本,但我想 运行 PyCharm.
中的所有内容代码如下:
import pythonping
pythonping.ping('47.241.107.35', verbose=True)
这是输出:
Traceback (most recent call last):
File "/Users/dominik/Documents/Pycharm Projects on MacOS/venv/scripts/test_pythonping.py", line 3, in <module>
pythonping.ping('47.241.107.35', verbose=True)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pythonping/__init__.py", line 73, in ping
comm = executor.Communicator(target, provider, timeout, socket_options=options, verbose=verbose, output=out,
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pythonping/executor.py", line 247, in __init__
self.socket = network.Socket(target, 'icmp', source=None, options=socket_options)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pythonping/network.py", line 33, in __init__
self.socket = socket.socket(socket.AF_INET, socket.SOCK_RAW, self.protocol)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/socket.py", line 232, in __init__
_socket.socket.__init__(self, family, type, proto, fileno)
PermissionError: [Errno 1] Operation not permitted
您可以 运行 PyCharm 作为管理员,然后所有脚本将 运行 具有管理员权限。