How to install packages for Python 3.6 in CentOS 7?

Installing pip package manager and Python 3.6 packages if they are missing from the operating system repository

  1. Download package get-pip.py:

    wget https://bootstrap.pypa.io/get-pip.py
    
  2. Install pip for required Python version:

    sudo python3.6 get-pip.py
    
  3. Install required package:

    python36 -m pip install [Package_to_install]
    

    Where [Package_to_install] is package name.

Installing pip package manager and Python 3.6 packages in virtual environment

  1. Create the virtual environment:

    python36 -m venv env --without-pip
    
  2. Activate the virtual environment:

    source env/bin/activate
    
  3. Install pip in virtual environment:

    curl https://bootstrap.pypa.io/get-pip.py | python3
    
  4. Install required package:

    pip3 install [Package_to_install]
    

    Where [Package_to_install] is package name.