-1

I have referenced this question: How do I activate a virtualenv inside PyCharm's terminal? As it mentions, PyCharm should support auto activate virtual env since 2016. But I fail to get it work.

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?

Sunderam Dubey
  • 1
  • 11
  • 20
  • 40
Hui Gordon
  • 345
  • 1
  • 3
  • 13

2 Answers2

0

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

  • I am using MacOS with zsh command shell. Sorry since I am not familiar with MacOS, just want to make sure that, does MacOS also have registry as Windows? How should I edit it? – Hui Gordon Apr 14 '22 at 06:05
0

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.

Hui Gordon
  • 345
  • 1
  • 3
  • 13