Using pip on Windows installed with both python 2.7 and 3.5
You will have to use the absolute path of pip
.
E.g: if I installed python 3 to C:\python35
, I would use:
C:\> python35\Scripts\pip.exe install packagename
Or if you're on linux, use pip3 install packagename
If you don't specify a full path, it will use whichever pip
is in your path
.
Because usually i change my intepreter to run something(i got 2 diff projects with both 2 and 3), i use these solution:
- Add path to the environment as usual (of course)
- Rename ur python.exe , in my case i want to run python 3 using command python3 on my cmd. So i renamed my python.exe in python3.x directory with python3. Itll works with python 2 ofc.
- Then to use pip in both python, i use this command.
python3 -m pip install 'somepackage'
and to run pip on python2
python -m pip install 'somepackage'
This is may not the best solution out there, but i like this one
** WINDOWS **
ref : https://datascience.com.co/how-to-install-python-2-7-and-3-6-in-windows-10-add-python-path-281e7eae62a