未定义Spyder'runfile' [英] Spyder 'runfile' is not defined

查看:378
本文介绍了未定义Spyder'runfile'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Spyder中运行脚本,但是出现以下错误:

I am trying to run a script in Spyder, but am getting the following error:

NameError: name 'runfile' is not defined.

我尝试了多种操作,例如更新PYTHONPATH变量,但似乎无济于事.
我有Python 2.7,Anaconda 2.4和Spyder 2.3.8.我将我的PYTHONPATH设置为:

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

推荐答案

此问题的来源与sitecustomize的导入有关.当您在Windows开始"菜单中单击所有程序">"Anaconda">"Anaconda提示符"时,这很明显.此项提供了一些见解:如何重置Spyder IDE(Python 2.7)图形用户界面?

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?

基本上,请转到命令提示符(在Windows中为cmd),然后键入以下内容:

Essentially, go to a command prompt (cmd in Windows) and type the following:

spyder --reset
spyder --default

这解决了潜在的sitecustomize问题,该问题解决了"runfile"未定义错误.

This resolved the underlying sitecustomize issue, which fixed the 'runfile' is not defined error.

这篇关于未定义Spyder'runfile'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆