Get the Anaconda prompt running in the PyCharm terminal
You can change pycharm settings to achieve this.
In Settings > Tools > Terminal, change the Shell path
as following:
cmd.exe "/K" "C:\Users\me\Miniconda3\Scripts\activate.bat" "C:\Users\me\Miniconda3"
And the C:\Users\me\Miniconda3
can be replaced by either one of your conda environment name such as base
Close the Terminal and reopen it, you will get the Anaconda prompt.
It works in my PyCharm Community Edition 2018.1.2
Here's what I got to work (its a variation of dd. post):
- right click 'anaconda powershell prompt' in the start menu; click 'open file location'
- right click 'anaconda powershell prompt' in file explorer; click 'properties'
- under 'shortcut' tab the 'target' line is what you need. mine looked like
%windir%\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy ByPass -NoExit -Command "& 'C:\ProgramData\Anaconda3\shell\condabin\conda-hook.ps1' ; conda activate 'C:\ProgramData\Anaconda3' "
- go to pycharm under settings -> tools -> Terminal
- leave the current powershell path (don't change it!), and append on:
-ExecutionPolicy ByPass -NoExit -Command "& 'C:\ProgramData\Anaconda3\shell\condabin\conda-hook.ps1' ; conda activate 'C:\ProgramData\Anaconda3' "
(this is part of the path above)
In fact, the full version can be written directly as
powershell.exe -ExecutionPolicy ByPass -NoExit -Command "& 'C:\ProgramData\Anaconda3\shell\condabin\conda-hook.ps1' ; conda activate 'C:\ProgramData\Anaconda3' "
No need to explicitly specify the path to powershell. (Still need to replace the path to anaconda with your own.)
(also make sure there is a space between the end of the powershell path and the dash)
- restart the terminal in pycharm and you should be in the base conda environment
For window user, first of all check the location of your anaconda environment
you could type conda env list
to show
For my case, the env I want to have my anaconda prompt is located at C:\Users\YOURUSERNAME\Anaconda3\
(which is the root env, the very first you get)
And then go to pycharm, go settings, go Tools, Inside Shell path enter
cmd.exe "/K" C:\Users\YOURUSERNAME\Anaconda3\Scripts\activate.bat C:\Users\YOURUSERNAME\Anaconda3
The shell path may differ, you can check from the properties of shortcut of 'Anaconda Prompt': rightClick on the icon of 'Anaconda Prompt' >> properties >> shortcut >> Target