Home > Blockchain >  PyCharm virtual environment is not automatically activated for zsh terminal, MacOS
PyCharm virtual environment is not automatically activated for zsh terminal, MacOS

Time:04-17

I have referenced this question: setting page of PyCharm Terminal

Above is my setting page for the PyCharm Terminal. I have checked the 'Activate virtualenv'.

PyCharm Terminal

But every time I start a terminal in PyCharm, it didn't automatically activate the virtual env. I need to manually use command conda activate <environment_name> to activate the environment.

I am using a Conda Environment installed with homebrew.

May I ask, is there any parameters that I can add to the Shell path (/bin/zsh) to make it automatically activate specific virtual env? Or other ways to solve this problem?

CodePudding user response:

I had it working. This has nothing to do with pycharm.

My issue was about anaconda HKEY_CURRENT_USER was still there even after uninstalling it.

1-You must check your PATH environment variable echo %PATH% in the command prompt and check for paths that do not exist anymore or check for the "&" sign and remove them.

2-The following may be this works for you:

Open the Registry Editor (press the Windows key, type Regedit and hit Enter). Navigate to HKEY_CURRENT_USER\Software\Microsoft\Command Processor\AutoRun and clear the values. Also, check HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\AutoRun

CodePudding user response:

I have solved this problem with an alternative method found in: https://stackoverflow.com/a/55658404/15416614

Although this question is originally asking about the Windows environment and it is in 4 years ago, there is an answer from 'Ethan Yanjia Li' that can still solve my current problem.

This seems to be a PyCharm bug that the 'Activate virtualenv' option is not working sometimes. It has been fixed before but reappears in some situations, according to: https://youtrack.jetbrains.com/issue/PY-23417.

  • Related