要求:运行文件的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()
解决方案:
我终于解决了
1.安装brew install GnuPG
- import gnupg gpg = gnupg. GPG('/usr/local/bin/gpg')
2条答案
按热度按时间r8xiu3jd1#
我安装了一个新的Python版本(3.10.0)和python-gnupg,它开始工作了:
gojuced72#
安装gnupg包
然后在对象初始化期间显式指定gpg二进制文件的路径。