如何在 Windows 终端上配置 Anaconda Shell,但使用 PowerShell 7。

huangapple go评论118阅读模式
英文:

How to configure an anaconda shell on windows terminal but with powershell 7

问题

Anaconda已安装在我的计算机上。Windows为我提供了一个Anaconda shell。
我按照这个教程的步骤将Anaconda shell添加为Windows终端提供的shell。
我的意思是,我在settings.json中添加了以下JSON元素:

{
    "commandline": "%SystemRoot%\\System32\\WindowsPowerShell\\v1.0\\powershell.exe  -NoExit -Command \"& 'C:\\Users\\gendraup\\AppData\\Local\\miniconda3\\shell\\condabin\\conda-hook.ps1'\"",
    "guid": "{61c54bbd-c2c6-5271-96e7-009a87fa24bf}",
    "hidden": false,
    "name": "anaconda PowerShell",
    "startingDirectory": "C:\\Users\\gendraup"
}

现在Windows终端提供了一个带有Anaconda的PowerShell。但我想要使用PowerShell 7而不是Windows PowerShell。

我已经使用Microsoft应用程序安装了PowerShell 7,我不需要配置Windows终端。
这行已经为我安装了:

{
    "guid": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
    "hidden": false,
    "name": "PowerShell",
    "source": "Windows.Terminal.PowershellCore"
}

我尝试在Anaconda shell配置中将"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe"替换为"Windows.Terminal.PowershellCore",但没有成功。

我尝试搜索PowerShell 7的安装路径,但Windows没有提供打开应用程序位置的选项。

英文:

Anaconda is already installed on my computer. Window propose me an anaconda shell.
I followed this tutorial to add the anaconda shell as proposed shell by windows terminal.
I means that I have added the following json element in settings.json

{
    commandline": "%SystemRoot%\\System32\\WindowsPowerShell\\v1.0\\powershell.exe  -NoExit -Command \"& 'C:\\Users\\gendraup\\AppData\\Local\\miniconda3\\shell\\condabin\\conda-hook.ps1'",
    guid": "{61c54bbd-c2c6-5271-96e7-009a87fa24bf}",
    hidden": false,
    name": "anaconda PowerShell",
    startingDirectory": "C:\\Users\\gendraup"
}

Now a powershell with anaconda is proposed by windows terminal. But I want to use powershell 7 not windows powershell.

I have install powershell 7 with microsoft app. I didn't have to configure windows terminal
This line was already install for me.

        {
            "guid": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
            "hidden": false,
            "name": "PowerShell",
            "source": "Windows.Terminal.PowershellCore"
        },

I tried to replace "%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe " with Windows.Terminal.PowershellCore. in anaconda shell configuration. It doesn't work.

I tried to search the reach path of powershell 7 but windows doesn't propose to open the app location.

答案1

得分: 0

打开 PowerShell 7
转到任务资源管理器。

右键单击 PowerShell 任务资源管理器。
打开文件目录。

在我的情况下,我得到了这个路径

C:\Program Files\WindowsApps\Microsoft.PowerShell_7.3.4.0_x64__8wekyb3d8bbwe\pwsh.exe

目前看起来它正在按预期工作

这段代码解决了问题,但我很好奇是否有一种简单的方法可以重用源 "Windows.Terminal.PowershellCore" 而不需要搜索文件路径。

英文:

open powershell 7
go to task explorer.

Right click on the powershell task explorer.
Open the file directory.

In my case I get this path

C:\Program Files\WindowsApps\Microsoft.PowerShell_7.3.4.0_x64__8wekyb3d8bbwe\pwsh.exe

and for the moment it looks it's working as expecting for now

this code solve the problem but I m curious to know if there a simple way to reuse source": "Windows.Terminal.PowershellCore" without searching the file path

huangapple
  • 本文由 发表于 2023年6月22日 17:21:16
  • 转载请务必保留本文链接:https://go.coder-hub.com/76530371.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定