关于 spyder 和 anaconda for python 的一个非常基本的设置问题
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24399154/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
A very basic setting issue about spyder and anaconda for python
提问by JonghoKim
I am a beginner of spyder IDE for Python.
我是 Python spyder IDE 的初学者。
To use spyder IDE, I command "spyder" on anaconda console with python 2.7
要使用 spyder IDE,我在 anaconda 控制台上使用 python 2.7 命令“spyder”
After that, I try to print "hi"
之后,我尝试打印“嗨”
But I encounter an error message
但是我遇到了错误消息
"No python shell is currently selected to run hu.py Please select or open a new Python interpreter and try again"
“当前没有选择 python shell 来运行 hu.py 请选择或打开一个新的 Python 解释器,然后再试一次”
How could I solve this problem?
我怎么能解决这个问题?
I saved my file on C:\Anaconda\practice_jhk
我将文件保存在 C:\Anaconda\practice_jhk
from __future__ import print_function
print ("hi")
采纳答案by wombatonfire
You can specify the Spyder's Run Settings in Run -> Configure (F6). By default "Execute in current Python or IPython console" is selected and you probably do not have any open console in Spyder.
您可以在 Run -> Configure (F6) 中指定 Spyder 的运行设置。默认情况下,“在当前 Python 或 IPython 控制台中执行”被选中,您可能在 Spyder 中没有任何打开的控制台。
You can select "Execute in a new dedicated Python console" option and Spyder will automatically open a new console for you. Or you can leave the dafault option and create a new console yourself in the Consoles menu.
您可以选择“在新的专用 Python 控制台中执行”选项,Spyder 将自动为您打开一个新的控制台。或者您可以离开 dafault 选项并在控制台菜单中自己创建一个新的控制台。
回答by Akash Kumar singh
I have had the same problem. I am not able to fix it but I am able to successfully run the program the following two ways and I don't find any problems till now:
我曾经也有过一样的问题。我无法修复它,但我能够通过以下两种方式成功运行该程序,并且到目前为止我没有发现任何问题:
- By selecting IPython console (not the one with the Kernel id as its tab) then running your program.
- By selecting "Execute in new dedicated Python console" from Tools --> Preferences --> Run.
- 通过选择 IPython 控制台(不是以内核 ID 作为其选项卡的控制台)然后运行您的程序。
- 通过从工具 --> 首选项 --> 运行中选择“在新的专用 Python 控制台中执行”。
回答by user3369577
I was getting the same error message, but then realized I was not directing the PATH to my Python interpreter file at all. How I solved the problem:
我收到了相同的错误消息,但后来意识到我根本没有将 PATH 指向我的 Python 解释器文件。我是如何解决问题的:
Go to Tools > PYTHONPATH manager
Select "Add path"
Find and select your Python interpreter folder (for me this was C:\Python27)
转到工具 > PYTHONPATH 管理器
选择“添加路径”
查找并选择您的 Python 解释器文件夹(对我来说这是 C:\Python27)
回答by Shirantha Madusanka
Try, tools -> Reset sypder to factory default. Then, click on the run button in the dialog box.
尝试,工具 -> 将 sypder 重置为出厂默认值。然后,单击对话框中的运行按钮。
回答by Karri Saipranav
You might have unexpectedly closed the Ipython console window which is open by default and henceforth
您可能意外关闭了默认打开的 Ipython 控制台窗口,此后