问题
I'm doing some work with a custom version of Python 2.6 on Windows, and would love to use emacs for this purpose. On more unixy platforms, I've never had any issue with the basic python-mode stuff, but now I'm encountering a problem when I try to use the M-x run-python
command.
My custom Python is on the path (i.e. can type python
from a windows command prompt and get the appropriate version). Unfortunately, I simply get the following error in my *Messages* buffer when attempting to start it with run-python
from emacs:
apply: Spawning child process: invalid argument
Is anyone running a similar python config that can shed light on this? Happy to post any other config details as needed.
回答1:
You could try C-u M-x run-python
, which gives you the option of selecting the path of the python binary you want to run.
Alternatively, if you would like to start it using Elisp, that can be achieved by calling (run-python "/usr/bin/python3")
for python3, for example.
回答2:
On Windows, when we use standard backward slashes in the init.el file (.emacs):
(setq python-shell-interpreter "c:\myRoot\Proframs\Python33\python3.exe"
)
Emacs interprets this as:c:myRootProframsPython33python3.exe
This what is the invalid argument I think.
Thus we can:
(setq python-shell-interpreter "c:/myRoot/Proframs/Python33/python3.exe"
)
Now C-u M-x "run-python" works.
来源:https://stackoverflow.com/questions/16720845/run-python-failing-on-emacs-24-3-1-for-windows-custom-vendor-supplied-python2