在Windows 10操作系统上面安装Miniforge,同时配置VSCode用来开发python。
执行文件时,可能会遇到如下错误:
然后执行命令:
1 2 Get-ExecutionPolicy Restricted
执行如下命令解决:
1 Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser
这时会变为Unrestricted
。
配置VSCode的Python开发环境 打开 VSCode,按 Ctrl + Shift + P 打开命令面板。
输入并选择 Python: Select Interpreter 命令。
选择Python解释器
配置VSCode使用Miniforge终端 打开 VSCode,点击左下角齿轮图标,选择 设置。
在搜索框中搜索 terminal.integrated.profiles.windows
添加代码 在settings.json中添加如下代码:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 "terminal.integrated.defaultProfile.windows" : "Miniforge Prompt" , "terminal.integrated.profiles.windows" : { "PowerShell" : { "source" : "PowerShell" , "icon" : "terminal-powershell" } , "Command Prompt" : { "path" : [ "${env:windir}\\Sysnative\\cmd.exe" , "${env:windir}\\System32\\cmd.exe" ] , "args" : [ ] , "icon" : "terminal-cmd" } , "Git Bash" : { "source" : "Git Bash" } , "Miniforge Prompt" : { "path" : "${env:windir}\\system32\\cmd.exe" , "args" : [ "/K" , "D:\\miniforge3\\Scripts\\activate.bat D:\\miniforge3" ] } } ,
添加 Miniforge Prompt,path和args就照抄安装Miniforge时Miniforge Prompt的属性里面的东西。
terminal.integrated.defaultProfile.windows
改成新配置的Miniforge Prompt。