簡體   English   中英

自動化PyDev Interpreter設置

[英]Automate PyDev Interpreter setup

我有一個場景,我希望能夠自動設置各種Python解釋器,以便在PyDev中使用。 這些解釋器具有特殊的環境變量,強制內置函數和庫定義。 有沒有辦法通過.ini文件或通過PyDev / Jython API以編程方式為PyDev定義Python解釋器?

在Java API中,它是這樣的:

IInterpreterManager manager = PydevPlugin.getPythonInterpreterManager(true);
manager.setInfos(exesList, interpreterNamesToRestore, monitor);

exesList是org.python.pydev.ui.pythonpathconf.InterpreterInfo的列表,interpreterNamesToRestore是已更改的interpreterNamesToRestore列表(即:應該恢復pythonpath)。

你可以從Jython那里做到這一點,但PyDev沒有提供你能夠做到的鈎子(即:它只提供用於設置編輯器的鈎子),因此,現在最好的解決方案是創建一個簡單的eclipse插件有一個earlyStartup來做你想要的配置(應該是直截了當的)。

我曾經對Eclipse插件互相挫敗並且破壞其他“原始”設置感到沮喪,但是我在這里挖了一遍,發現了這些漂亮的花絮:

Eclipse運行時選項 (cli選項用於運行本來是強制UI功能的選項)。

從CLI運行Eclipse的更新管理器

所以,如果你仔細閱讀運行時選項,你會遇到..

eclipse.pluginCustomization {-pluginCustomization}
the file system location of a properties file containing default settings for 
plug-in preferences. These default settings override default settings 
specified in the primary feature. Relative paths are interpreted relative 
to the current working directory for Eclipse itself.

哪個可能會做你想要的。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM