RuntimeError: GnuPG is not installed
RuntimeError: GnuPG is not installed
要求:要运行解密python文件
我在 MacOS 的虚拟环境中安装了 gnupg,同样 import gnupg
工作正常,但第二行抛出如下错误
>>> gpg = gnupg.GPG() Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Users/krajashekaran/.local/share/virtualenvs/mypython-sPLN-T2A/lib/python3.8/site-packages/gnupg/gnupg.py", line 117, in __init__ super(GPG, self).__init__( File "/Users/krajashekaran/.local/share/virtualenvs/mypython-sPLN-T2A/lib/python3.8/site-packages/gnupg/_meta.py", line 182, in __init__ self.binary = _util._find_binary(binary) File "/Users/krajashekaran/.local/share/virtualenvs/mypython-sPLN-T2A/lib/python3.8/site-packages/gnupg/_util.py", line 429, in _find_binary raise RuntimeError("GnuPG is not installed!") RuntimeError: GnuPG is not installed!
代码
import gnupg
gpg = gnupg.GPG()
SOLUTION:
终于解决了,
- 正在安装
brew install GnuPG
- 导入 gnupg
gpg = gnupg.GPG('/usr/local/bin/gpg')
我安装了全新的 Python 版本 (3.10.0) 和 python-gnupg,它开始工作了:
pip3 install python-gnupg
要求:要运行解密python文件
我在 MacOS 的虚拟环境中安装了 gnupg,同样 import gnupg
工作正常,但第二行抛出如下错误
>>> gpg = gnupg.GPG() Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Users/krajashekaran/.local/share/virtualenvs/mypython-sPLN-T2A/lib/python3.8/site-packages/gnupg/gnupg.py", line 117, in __init__ super(GPG, self).__init__( File "/Users/krajashekaran/.local/share/virtualenvs/mypython-sPLN-T2A/lib/python3.8/site-packages/gnupg/_meta.py", line 182, in __init__ self.binary = _util._find_binary(binary) File "/Users/krajashekaran/.local/share/virtualenvs/mypython-sPLN-T2A/lib/python3.8/site-packages/gnupg/_util.py", line 429, in _find_binary raise RuntimeError("GnuPG is not installed!") RuntimeError: GnuPG is not installed!
代码
import gnupg
gpg = gnupg.GPG()
SOLUTION:
终于解决了,
- 正在安装
brew install GnuPG
- 导入 gnupg gpg = gnupg.GPG('/usr/local/bin/gpg')
我安装了全新的 Python 版本 (3.10.0) 和 python-gnupg,它开始工作了:
pip3 install python-gnupg