如何为特定的口译员获取PYTHONHOME?

时间:2019-01-10 23:59:02

标签: python python-embedding

我正在尝试枚举可用的Python解释器,并且我需要它们的主路径,以便可以加载pythonXXX动态库。

我可以通过在PATH中列出目录来找到可执行文件。但是,我找不到如何为新找到的可执行文件获取默认的PYTHONHOME。它未设置在外部,因此Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) Dim strFileName(0 To 1) As String, sPath As String sPath = "M:\Sales\Rate Calculators\John\" strFileName(0) = "Rate Calculator v14" strFileName(1) = InputBox("What would you like to save the file as?") ActiveWorkbook.SaveCopyAs Filename:=sPath & "\" & Join(strFileName) & ".xlsx" End Sub 抛出os.environ['PYTHONHOME']

嵌入API时有KeyError,但是要到达那里,我首先需要加载动态库。

是否有办法从解释器本身获取Py_GetPythonHome的返回值?

0 个答案:

没有答案