如何将python powshell环境编码改为utf-8
一、要改的文件位置 可任选
1、%windir%\system32\WindowsPowerShell\v1.0\profile.ps1
它作用于所有用户、所有的Shell。
2、%windir%\system32\WindowsPowerShell\v1.0\ Microsoft.PowerShell_profile.ps1
作用于所有用户,但只作用于Microsoft.PowerShell这个shell。这个我也没懂是什么意思,难道还有不是PowerShell的PowerShell shell?呃,有点像绕口令。
3、%UserProfile%\My Documents\WindowsPowerShell\profile.ps1
作用于当前用户的所有shell。
4、%UserProfile%\My Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1
作用于当前用户的Microsoft.PowerShell这个shell。
二、 要改的内容
$OutputEncoding = [Console]::OutputEncoding = (new-object System.Text.UTF8Encoding $false)
$env:PYTHONIOENCODING = "utf-8"