Why is Anaconda source activate non-existent?

2020-07-03 07:25发布

I successfully created two separate Python environments in Anaconda, yet seem to be unable to activate either one of them. I have tried to read up on this topic as much as possible here on Stackoverflow, yet no solution did resolve my issue. I added information asked for by comments in this question (Anaconda Environment Doesnt activate).

When trying to activate an environment, the console output is -bash: activate: No such file or directory.

The output of which conda is /Users/username/anaconda3/bin/conda. The output of type source is source is a shell builtin. When trying which activate, the shell returns nothing.

In my bin folder, I also seem not to have an activate executable, but only one which is called activate-global-python-argcomplete.

Why do I lack the standard activate file and how I could resolve this issue best?

8条回答
一夜七次
2楼-- · 2020-07-03 07:41

Start a new terminal and try again. Alternatively, type hash -r and see if it helps.

查看更多
Ridiculous、
3楼-- · 2020-07-03 07:53

In this case, the problem might be that the virtual environment was created in /Users/username/anaconda3/envs/ and hence the activate will be in: /Users/username/anaconda3/envs/NAME_OF_YOUR_VIRTUAL_ENV/bin/activate

Hence to activate the environment you could run:
source /Users/username/anaconda3/envs/NAME_OF_YOUR_VIRTUAL_ENV/bin/activate

查看更多
太酷不给撩
4楼-- · 2020-07-03 07:54

My problem was that file /opt/pycharm/plugins/terminal/.zshrc (using ZSH) contained line source $JEDITERM_SOURCE. That variable contained correct paths as two parameters <path-to-anaconda-activate>/activate <path-to-anaconda>, but apparently they got interpreted as a single parameter: <path-to-anaconda-activate>/activate <path-to-anaconda>.

I solved that prepending eval to that line, making it eval source $JEDITERM_SOURCE. Now, the variable expands correctly.

If you're using bash then make the same change to /opt/pycharm/plugins/terminal/jediterm-bash.in.

查看更多
不美不萌又怎样
5楼-- · 2020-07-03 07:55

tcsh was the problem for me. Changed to bash and all is ok.

查看更多
看我几分像从前
6楼-- · 2020-07-03 07:57

I think you happened to install a buggy version of anaconda which was quickly patched.

conda update conda

should get you back up and running.

查看更多
太酷不给撩
7楼-- · 2020-07-03 08:00

I experience a similar problem. In my case, the problem is related to the use of the tcsh, but activate only supports bash and zsh.

You can check your current used shell with the command echo $0.

You have to use a compatible shell in order to use the source activate command.

查看更多
登录 后发表回答