控制台运行python文件_如何在IPython控制台中默认运行文件而不是终端?

1586010002-jmsa.png

I started a new project in PyCharm. I have Anaconda 3.6 installed. So, in PyCharm, I selected the Anaconda python.exe as project interpreter.

When I first ran PyCharm, it used the IPython console as "default" console to run my script. Then I restarted my PC and now PyCharm uses the terminal when I run my scripts. Why? I don't want to use the terminal, coming from Anaconda Spyder IDE. I'm used to IPython, I like it and I want to use it.

How can I completely disable the terminal and use only the IPython console?

解决方案

Short answer:

Go to File > Default settings > Build, Execution, Deployment > Console and select Use Ipython if available

Go to Run > Edit Configurations and select Show command line afterwards

Tip: Run selected parts of your code with ALT + SHIFT + E

The details:

If you've selected Anaconda as the project interpreter, IPython will most likely be the selected console even though it neither looks nor behaves like the IPython console you are used to in Spyder.

I guess you are used to seeing this in Spyder:

cCHDC.png

I'm also guessing that the following is what you're seeing in PyCharm in the Console Window:

SXtOL.png

Unlike Spyder, PyCharm has no graphical indicator showing that this is an IPython console. So, to make sure it's an IPython console and make it behave more or less like the IPython console you are used to from Spyder, you should try to follow these two steps:

Go to File > Default Settings > Build, Execution, Deployment > Console and make sure to select Use IPython if available.

gi77e.png

Go to Run > Edit Configurations and select Show command line afterwards

eiM3R.png

Now you can run selected parts of your code with ALT+SHIFT+E more or less exactly like in Spyder.

If this doesn't do the trick, you should check out these other posts on SO:

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值