0

I already have pretty table installed on Python 3.6 but I want to install it on python 3.8. So when I do pip install prettytable, it shows that the package has already been installed for 3.6 but like I said that I also want it on Python 3.8.

How can I do that? I need both versions of Python for different projects. I use VSCode.

rioV8
  • 24,506
  • 3
  • 32
  • 49
  • Does this answer your question? [Dealing with multiple Python versions and PIP?](https://stackoverflow.com/questions/2812520/dealing-with-multiple-python-versions-and-pip) – mkrieger1 Feb 11 '21 at 15:42

3 Answers3

0

You can check which python versions you have and where are they stored by running:

whereis python

Then knowing where is your python3.8 installed, just run this with the absolute path.

For example:

/usr/bin/python3.8 -m pip install prettytable
or
/usr/local/bin/python3.8 -m pip install prettytable
Ángel Igualada
  • 891
  • 9
  • 13
0

It depends on your system and on the way you can start the different Python versions.

On Windows, you would use the py launcher:

py -3.8 -m pip install package_name

On Linux or any other Unix-like, you normally run directly the various installed python executable with their version as a suffix, so it should be:

python3.8 -m pip install package_name
Serge Ballesta
  • 143,923
  • 11
  • 122
  • 252
  • hey, I use a MacBook . –  Feb 11 '21 at 15:49
  • @angadsinghbedi: If I am not mistaken, the underlying system should be Darwin which is derivated from BSD Unix. So the Unix-like method should work (the exact name of the executable may slightly vary among systems, some adding `-` or `.` character in the name) – Serge Ballesta Feb 11 '21 at 16:02
0

If you want an alternative to dealing with different python versions on your PC, I extremely recommend using anaconda (or the minimal version miniconda) in such cases.

Miniconda is easy to use and helps you manage your python environments. Putting myself in your shoes, I would install miniconda from here, and do the following.

Open anaconda prompt and type:

conda create -n some_env_name python=3.8
conda activate some_env_name
pip install prettytable

You can follow this document on how to activate a python environment in VS CODE.

Ori David
  • 332
  • 3
  • 13