问题
I am trying to run a script in Spyder
, but am getting the following error:
NameError: name 'runfile' is not defined.
I tried a variety of things, like updating the PYTHONPATH variable, but nothing seems to be helping.
I have Python 2.7, Anaconda 2.4, and Spyder 2.3.8. I have my PYTHONPATH set to:
C:\anaconda\\...\externalshell
回答1:
The source of this was an issue with the import of sitecustomize. This was apparent when you clicked on All Programs>Anaconda>Anaconda Prompt in the Windows Start Menu. This entry offered some insight with that: How to reset Spyder IDE (Python 2.7) graphic user interface?
Essentially, go to a command prompt (cmd in Windows) and type the following:
spyder --reset
spyder --default
This resolved the underlying sitecustomize issue, which fixed the 'runfile' is not defined error.
来源:https://stackoverflow.com/questions/38250361/spyder-runfile-is-not-defined