2

I have windows 10 with 2 user accounts, one is an old one that has Python installed. My latest account also has Python installed. I used pip install tweepy, and it now exists in the site packages. If I open my Python shell (v3.6.5), it imports fine. However, I can't get this to work when switching to Python in cmd. In here, after typing python, it says Python 3.6.6. Obviously they are different, yet they seem to be originating from the same directory.

Any ideas?

[edit] I have just realised that I have an external application that runs on Python 3.6.6., so I guess it's defaulting because of that. However, I can't uninstall that since I need it - is there a way to specify which version of Python is launched when I type python into the cmd?

[edit2]: This is the issue, and the solution there works. However, I want to be able to just type python into cmd, rather than the entire path. Since both exist in the path (and I don't want to remove the other 3.6.6.), is there a way to achieve this?

fffrost
  • 1,659
  • 1
  • 21
  • 36
  • 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) – Masoud Jul 06 '19 at 20:23
  • on Linux python creates program with its number so I can type `python`, `python2`, `python2.7`, `python3`, `python3.6`, `python3.7`, etc. The same with `pip`, `pip2`, `pip2.7`, `pip3`, `pip3.6`, `pip3.7` – furas Jul 06 '19 at 20:37
  • When installing python have you installed `py.exe.`? You can set ENV `PY_PYTHON=3.6.5` to start this version as default. – mx0 Jul 06 '19 at 21:54
  • I don't have py.exe for the version I'm trying to use, but I seem to have it for Anaconda, and it starts with that (which is 3.7.3 – fffrost Jul 06 '19 at 21:59

2 Answers2

3

Have you thought about using a virtual environment?

https://virtualenv.pypa.io/en/latest/

Zaya
  • 508
  • 4
  • 8
0

When you enter "python" into your cmd it searched python.exe in the directories listed on your PATH variable.

All you need to do is to modify your PATH and add the directory path in which the python with the desired version is located.

omer bar lev
  • 341
  • 1
  • 4
  • 11