在更改系统区域设置,将区域设置为Beta版:UTF-8后,Anaconda终端变成点阵字体,严重影响阅读。
怎么才能修改终端字体呢?一开始是从配置文件入手。
Anaconda配置文件位于
C:\Users\%username%\.condarc
如果没有,使用以下命令创建
conda config --set show_channel_urls yes
但是后来我发现配置文件里不能设置字体和大小。
Anaconda终端本质上的是电脑终端。Anaconda Prompt对应着cmd终端,Anaconda Powershell Prompt对应着Powershell终端。
Anaconda Prompt设置字体样式
Anaconda Prompt用的是windows的cmd终端,以管理员方式Anaconda Prompt运行,右键上方白色缓冲区,点击属性,在弹出的窗口中设置字体样式和大小,圆圈区域内是样式预览,点击确定,不放心的话可以把默认值也改成一样的。有些电脑可能需要重启才会生效。
Anaconda Powershell Prompt设置字体样式
Anaconda Powershell Prompt用的是windows的Powershell终端,用上面的方法修改后,重新打开没变化。各位有什么好的方法,希望告知。
方法一(没有效果)
在 PowerShell 中使用以下命令来打开或创建个人配置文件:
打开现有配置文件(如果存在)
notepad $PROFILE
创建新配置文件(如果不存在)
New-Item -Path $PROFILE -Type File -Force
在配置文件里添加代码段
Add-Type -TypeDefinition @"
using System;
using System.Runtime.InteropServices;
using Microsoft.Win32;
public class FontUtils
{
[DllImport("gdi32.dll", EntryPoint = "AddFontResourceW", SetLastError = true)]
public static extern int AddFontResource([In][MarshalAs(UnmanagedType.LPWStr)] string lpFileName);
[DllImport("gdi32.dll", EntryPoint = "RemoveFontResourceW", SetLastError = true)]
public static extern int RemoveFontResource([In][MarshalAs(UnmanagedType.LPWStr)] string lpFileName);
public static void SetConsoleFont(string fontName, short fontSize)
{
Registry.SetValue(@"HKEY_CURRENT_USER\Console", "FaceName", fontName);
Registry.SetValue(@"HKEY_CURRENT_USER\Console", "FontSize", fontSize);
}
}
"@
[FontUtils]::SetConsoleFont("Consolas", 24)