-1

I have installed python 2.7 on my computer. I am able to run python from anaconda but not from command line. The command line says python not found.

Also, how can I have two python versions(2.7 and 3.4) at the same time?

  • If you want two Python versions, you should install them on a virtualenv to not cause conflict betwen then. Can you run `python --version` on your command line? It seems you have not installed python properly. – Víctor López Sep 25 '17 at 14:32
  • did you add the python path? – Dayana Sep 25 '17 at 14:34
  • 1
    Possible duplicate of [How to run multiple Python versions on Windows](https://stackoverflow.com/questions/4583367/how-to-run-multiple-python-versions-on-windows) – serakfalcon Sep 26 '17 at 08:34

4 Answers4

1

run this command line:

ipython myprogram.py

To create a new virtual environment with a specific version of python, using conda:

conda create -n my_env python=3.6

To switch environments:
on osx/linux: source activate my_env
on windows: activate my_env
to exit source deactivate, or deactivate on windows

more details here: managing conda environments

Reblochon Masque
  • 35,405
  • 10
  • 55
  • 80
0

It can be, that two different python versions are running on your pc. Make sure, you have the same version running on anaconda and the command line.

LLJ97
  • 500
  • 3
  • 6
  • 19
0

If on windows just install them both and rename the python.exe tot python2.exe for version 2.7 and python3.exe for python 3.

Now you can call python 2 in the command prompt with python2

and you can acces python3 with python3

Also make sure your python path is in your environment variables.

YetAnotherDuck
  • 294
  • 4
  • 13
0

Sure, you can have two Pythons installed.

The command line searches the executable you wanted to run (python, in this case) in the current directory and in all directories specified in PATH environment variable.

It depends on OS, but search how to insert the binary directory (where the python executable resides) into the PATH environment variable.

Neo
  • 3,534
  • 2
  • 20
  • 32