擅长:python、mysql、java
<p>GnuPG主目录是GnuPG存储其密钥环和信息的地方。不能使用此配置变量来确定Python模块在何处搜索二进制文件。事实上,这个<em>never</em>应该设置为二进制文件的存储位置(无论如何也不应该在程序文件目录中)。在</p>
<p>相反,请将目录添加到<code>%PATH</code>环境变量或使用<a href="https://pythonhosted.org/gnupg/gnupg.html#gnupg-module" rel="nofollow noreferrer">^{<cd2>}</a>变量,该变量应包含二进制文件的绝对路径:</p>
<pre><code>gpg = gnupg.GPG(binary='C:/Program Files (x86)/GnuPG/bin/gpg.exe')
</code></pre>
<p>从<a href="https://pythonhosted.org/gnupg/gnupg.html#gnupg-module" rel="nofollow noreferrer">Python module's documentation</a>:</p>
<blockquote>
<p><code>binary</code> (<code>str</code>) – Name for GnuPG binary executable. If the absolute path is not given, the environment variable <code>$PATH</code> is searched for the executable and checked that the real uid/gid of the user has sufficient permissions.</p>
<p><code>homedir</code> (<code>str</code>) – Full pathname to directory containing the public and private keyrings. Default is whatever GnuPG defaults to.</p>
</blockquote>