LoginSignup
5
2

More than 3 years have passed since last update.

VSCodeからAnaconda Powershell Promptを利用する

Posted at

経緯

Windows環境でAnaconda Power ShellをVSCodeのターミナルとして設定する記事がないのでメモとして書いておきます.

Anaconda Promptを設定する記事はたくさんあったのですが,Unixコマンドが使えないのがストレスだったので慣れているPower Shellを利用したいと思ったのがきっかけです.

settings.jsonの編集

下記手順に従う
1. Anaconda Powershell Promptを検索
2. 右クリックして「ファイルの場所を開く」
3. Anaconda Powershell Promptのプロパティからリンク先の文字列をコピー
4. コピーした文字列のPowershellのパスを指定するコマンド部分をVSCodeのsettings.jsonでterminal.integrated.shell.windowsに指定する
5. 引数部分をterminal.integrated.shellArgs.windowsに列挙する

settings.json
{
    "terminal.integrated.shell.windows": "[Powershellのパス]",
        "terminal.integrated.shellArgs.windows": [
            "[コマンドの引数1]",
            "[コマンドの引数2]"
        ]
}

コマンドの書き方が若干わかりにくいので例↓

settings.json
{
    "terminal.integrated.shell.windows": "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
    "terminal.integrated.shellArgs.windows": [
        "-ExecutionPolicy",
        "ByPass",
        "-NoExit",
        "-Command", 
        "C:\\ProgramData\\Anaconda3\\shell\\condabin\\conda-hook.ps1",
        "; conda activate 'C:\\ProgramData\\Anaconda3'"
    ]
}

参考文献

5
2
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
2