I have a conda environment at the default location for windows, which is C:\ProgramData\Anaconda2\envs\myenv
. Also, as recommended, the conda scripts and executables are not in the %PATH%
environment variable. I opened a project in pycharm and pointed the python interpreter to C:\ProgramData\Anaconda2\envs\myenv\python.exe
and pycharm seems to work well with the environment in the python console, in the run environment, and in debug mode.
However, when opening the terminal the environment is not activated (I made sure that the checkbox for activating the environment is checked). To be clear - when I do the same thing with a virtualenv the terminal does activate the environment without a problem.
Here are a few things I tried and did not work:
Scripts
folder under the environmentNone of these worked. I can manually activate the environment without a problem once the terminal is open, but how do I do it automatically?
To create a Conda environment Do one of the following: Click the Python Interpreter selector and choose Add New Interpreter. Press Ctrl+Alt+S to open the project Settings/Preferences and go to Project: <project name> | Python Interpreter. Click the Add Interpreter link next to the list of the available interpreters.
Reload Window from Command Palette, select base:conda as python interpreter then press Ctrl+Shift+` to open a new integrated Terminal, conda environment should be activated automatically in it.
I ran into the same problem and used this solution.
Go to File -> Settings -> Tools -> Terminal
.
Replace the value in Shell path
with cmd.exe "/K" C:\path\to\Anaconda3\Scripts\activate.bat your_environment_name
.
If I installed Anaconda in C:\Anaconda3
and have an environment named myenv
, then my settings would look like this:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With