0
我想使用Python/C API執行Python腳本(我正在使用Mac OS X Mavericks,Xcode)。由於我的機器上安裝了多個Python發行版(System,Homebrew,幾個virtualenvs),我怎樣才能定義使用哪個?如何選擇python可執行文件,如果存在幾個?
我想使用Python/C API執行Python腳本(我正在使用Mac OS X Mavericks,Xcode)。由於我的機器上安裝了多個Python發行版(System,Homebrew,幾個virtualenvs),我怎樣才能定義使用哪個?如何選擇python可執行文件,如果存在幾個?
可以定義或者要使用哪一個:
例如,我都Python 2.7版和Python 3.2本機上:
$ python
Python 2.7.3 (default, Dec 18 2012, 13:50:09)
[GCC 4.5.3] on cygwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
$ python3
Python 3.2.3 (default, Jul 23 2012, 16:48:24)
[...]
$ /usr/bin/python2.7
Python 2.7.3 (default, Dec 18 2012, 13:50:09)
[...]
$ /usr/bin/python3.2
Python 3.2.3 (default, Jul 23 2012, 16:48:24)
[...]
我試圖通過'Py_SetProgramName( 「路徑/到/蟒」)'來做到這一點。但是,如果我檢查'Py_GetProgramFullPath()'它會返回一個不同的路徑。如何指定可執行文件的完整路徑? – DaPhil