2

Every time I try to create a new environment with anaconda in the Windows Command Prompt I get this error:

File "<stdin>", line 1
  conda create -n 11 python=3.6
             ^

SyntaxError: invalid syntax

I use this command to create the environment:

conda create -n 11 python=3.6

Screenshot of error in command prompt

3 Answers 3

5

You are supposed to use a terminal not the Python interpreter to execute those commands.

Search for terminal in search menu of you computer (cmd on Windows, terminal on Linux) and open that then try those commands and it should work.

Just make sure that it is not the Python interpreter (it will not have >>>) or a Python script.

Sign up to request clarification or add additional context in comments.

4 Comments

Thank you. i typed the command in cmd and anaconda prompt and i got "conda is not recognized as an internal or external command " error
@tokaaliamien You will need to add it to path then. See stackoverflow.com/questions/28612500/…
If you have indeed installed it :-) if not see conda.io/docs/user-guide/install/index.html and the problem should be fixed
@tokaaliamien No problem, like pip it is important to read the documentation very carefully to see how it should be used, if you are not sure trying both is often a good idea, also another rule is to remember that Python commands often require (), those to be run in a terminal generally do not so that might be a way to differentiate between the two. :-)
0

Open Anaconda prompt terminal NOTE: Run as administrator or it will fail after wasting your time.

type: conda create -n 11 python=3.6

follow the console instructions

Comments

0

make sure to use the terminal as a previous comment said.

In case you use VS Code, you can just type exit() in the python interpreter section to get back to the terminal/Powershell session.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.