如何更改IPython Shell文本文字颜色(Windows Powershell)

https://stackoom.com/question/3kgln/%E5%A6%82%E4%BD%95%E6%9B%B4%E6%94%B9IPython-Shell%E6%96%87%E6%9C%AC%E6%96%87%E5%AD%97%E9%A2%9C%E8%89%B2-Windows-Powershell

重点敲黑板:

C:\Users\xuzhen.ipython\profile_default

ipython profile create
产生的ipython_config文件是在这里,而不是你想要改变的环境的目录!天坑
默认的字体颜色都不行,暗红色字体在黑色背景下根本看不清

powershellipython

问题定义

我在Windows Powershell上使用IPython。 由于某种原因,字符串文字的颜色是深红色,难以理解:

Powershell中的Ipython

为了进行比较,这是使用powershell“ shell”和Ipython在VSCode上的外观:

IPython在VSCode中的Powershell中

IPython当然使用一些命令来告诉外壳要使用的颜色。 如何将字符串文字颜色修改为浅红色? 我希望这是计算机范围(或至少用户范围)的设置。powershellipython

3 个回复

按投票数排序按时间排序

===============>>#1 票数:3

这是我为使文本更具可读性所做的工作。 感谢SO用户TheoChristoph为我指出了正确的方向。

1.检查~\\.ipython没有任何配置文件

  • 在Windows上~转换为C:\\Users\\<USER>\\ 。

2.跑ipython profile create

  • 输出是
PS C:\Somefolder> ipython profile create
[ProfileCreate] Generating default config file: 'C:\\Users\\<USER>\\.ipython\\profile_default\\ipython_config.py'

3.编辑了ipython_config.py

  • 编辑了以下行:
#c.TerminalInteractiveShell.highlighting_style_overrides = {}

进入

from pygments.token import Token
c.TerminalInteractiveShell.highlighting_style_overrides = {Token.String: '#ff0000'}

发表评论