简体   繁体   中英

I got a syntax error by activating environment on Conda

Here is the complete code that I typed in:

input:

conda create --name my_app27 python=2.7 flask sqlalchemy --yes

source activate my_app27

output:

File "<ipython-input-2-9a6e240537c9>", line 1
    source activate my_app27
                  ^
SyntaxError: invalid syntax

And then I tried another one

input:

conda activate my_app27

output:

    CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
    To initialize your shell, run
    
        $ conda init <SHELL_NAME>
    
    Currently supported shells are:
      - bash
      - fish
      - tcsh
      - xonsh
      - zsh
      - powershell
    
    See 'conda init --help' for more information and options.
    
    IMPORTANT: You may need to close and restart your shell after running 'conda init'.


Note: you may need to restart the kernel to use updated packages.

Why is that?? What should I do if I get a syntax Error by activating the environment?

Instead of source activate my_shell type conda activate my_shell.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM