Hack Forums
[Python] Using pip with multiple versions of Python installed - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [Python] Using pip with multiple versions of Python installed (/showthread.php?tid=5998782)



Using pip with multiple versions of Python installed - lockhead - Aug 13, 2019

So I already have 2 versions of Python installed (2.7 and 3.7) but I want to get into machine learning with tensorflow.  
Tensorflow requires Python version 3 or above, but doesn't support 3.7 so I installed Python3.6.

Now in Python36/Scripts I have pip3.6.exe and pip3.exe. If I try to install tensorflow like so
Code
pip3.6.exe -m install tensorflow

I get the following error output

Code
Traceback (most recent call last):
 File "g:\python3.6.8\lib\runpy.py", line 193, in _run_module_as_main
   "__main__", mod_spec)
 File "g:\python3.6.8\lib\runpy.py", line 85, in _run_code
   exec(code, run_globals)
 File "G:\Python3.6.8\Scripts\pip3.exe\__main__.py", line 5, in <module>
ModuleNotFoundError: No module named 'pip'

I tried renaming pip3.6 to just pip but it didn't work, so any help would be greatly appreciated!


EDIT:
I found a solution (workaround?) by installing pip via easy_install
Code
easy_install-3.6.exe pip

Still can't install tf, but that's a seperate issue...


RE: Using pip with multiple versions of Python installed - Wiked™ - Aug 13, 2019

Code
python -m pip install package
always works using the correct python path variable


RE: Using pip with multiple versions of Python installed - Lindros - Aug 13, 2019

What integrated development environment are you using?


RE: Using pip with multiple versions of Python installed - xapox - Aug 16, 2019

Use virtualenv for that purpose and for development as well it will help you to not thrash your system with different packages but keep only necessary ones, same will go for development environment
Create environment
Code
virtualenv --python=/usr/bin/python3.6 <path/to/new/virtualenv/>
Or change path to python above.
To activate environment use:
Code
source <path/to/new/virtualenv/bin/activate>
to deactivate simply write deactivate.


RE: Using pip with multiple versions of Python installed - Xamarin - Aug 17, 2019

Make a favor to yourself and don't install them like that, but rather use PyEnv. It will save you from tons of frustration as soon you set it up and running.


RE: Using pip with multiple versions of Python installed - datguy.dev - Aug 17, 2019

You forgot pip. Instead of "pip3.6.exe -m install tensorflow" do "pip3.6.exe -m pip install tensorflow"