0

I have python3.7 installed but also python3.4. For example:

$ python3
Python 3.4.3 (default, Nov 12 2018, 22:25:49) 
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.

And:

$ python3.7
Python 3.7.0 (default, Jun 28 2018, 00:00:00) 
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.

How can I install packages to python3.7 ? Any pip3 command I use goes to python3.4 and I'm not sure how to install anything for python3.7. Any ideas? Even running something like this doesn't work:

$ python3.7 -m ensurepip --upgrade
/usr/bin/python3.7: No module named ensurepip

Or:

$ sudo python3.7 -m pip install PyMySQL
    register_loader_type(importlib_bootstrap.SourceFileLoader, DefaultProvider)
AttributeError: module 'importlib._bootstrap' has no attribute 'SourceFileLoader'
David542
  • 104,438
  • 178
  • 489
  • 842
  • Does this answer your question? [Install a module using pip for specific python version](https://stackoverflow.com/questions/10919569/install-a-module-using-pip-for-specific-python-version) – AMC Feb 08 '20 at 02:09

2 Answers2

1

I don't know whether this may be an appropriate solution for you. But this is what I generally follow. Just install Anaconda in your system and create different environments according to your needs. For your case create two different environments one for Python 3.4.3 and another for Python 3.7 using the following command

conda create --name py34 python=3.4.3 and 
conda create --name py37 python=3.7 
//This lines will create two new environments named py34 and py37     

You then install libraries according to your needs in the respective environment. Now you can work into each environment without interfering with the libraries of the other environment. To use anaconda kindly follow Anaconda cheatsheet. You will get everything that you need.

Hope this will help you.

Saurav Rai
  • 2,171
  • 1
  • 15
  • 29
1

This might help : It addresses the same issue as yours. In short, try

python3.7 -m pip install pip

Here's a reference documentation

axr6077
  • 39
  • 8