Anaconda Prompt起動時にディレクトリと環境を指定する(Windows 10)
Anacondaで開発をしていると、
Promptを立ち上げるたびに環境変えてディレクトリ移動してという作業がつらいので
デフォルトのディレクトリと環境を変更できないかと調べていました。
バージョンの違いなのか、いまいち解決方法が見つからなかったのですが、
下記のスレッドの中にショートカットの設定でprompt起動時に起動ディレクトリと環境を変更する方法が投稿されていました。
How to change default Anaconda python environment
環境
- Windows 10(64 bit)
- Anaconda 2020.02
指定方法
まずAnaconda Promptのファイルロケーションを開きます。
するとショートカットがあるので、Anaconda Power Shell Prompt(anaconda3)を右クリックしてプロパティを表示します。
Targetが環境の指定でStart Inが起動ディレクトリの指定になっています。
環境
初期では下記の様に、最後の方にactivateのコマンドが記載されています。
%windir%\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy ByPass -NoExit -Command "& 'C:\Users\{user}\anaconda3\shell\condabin\conda-hook.ps1' ; conda activate 'C:\Users\{user}\anaconda3' "
この部分ですね。
conda activate 'C:\Users\{user}\anaconda3'
これを下記の様にすればPrompt実行時に指定した環境に切り替えを行ってくれます。
conda activate 'C:\Users\{user}\anaconda3\envs\{環境}'
ディレクトリ
これは単純にStart Inに初期のディレクトリを入れてあげれば、Prompt起動時にそのディレクトリに移動してくれます👍
Author And Source
この問題について(Anaconda Prompt起動時にディレクトリと環境を指定する(Windows 10)), 我々は、より多くの情報をここで見つけました https://qiita.com/atsonic/items/edb73b43aa26d1c46de8著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .