0

I installed python3, when I enter python3 in the terminal (on RHEL) I get an error saying 'command not found'. Entering python gets me the 2.x version that came on the computer. Any advice on how I can access python3 from the terminal?

Aran-Fey
  • 39,665
  • 11
  • 104
  • 149
sunil barve
  • 1
  • 1
  • 4
  • it seems you need to add python3 to your path variable. Please refer to this discussion: https://www.linuxquestions.org/questions/linux-general-1/how-does-the-default-path-get-set-on-rhel-584001/ – Andre Motta Jul 13 '18 at 14:33
  • 2
    Possible duplicate of [Installing Python 3 on RHEL](https://stackoverflow.com/questions/8087184/installing-python-3-on-rhel) – Druta Ruslan Jul 13 '18 at 14:46

1 Answers1

2

Where did you install Python 3 from? Out of the box on RHEL 6 and 7 there are no Python 3 packages. There are supported packages from Red Hat that are part of Red Hat Software collections. To use them you have to enable the RHSCL repo, then install rh-python36. These packages are installed in /opt/rh, not /usr/bin, so you need to use scl enable rh-python36 bash to get a shell with the correct path.

See How to install Python 3 on RHEL on the Red Hat Developer Blog.

It covers:

  • Installing Python 3, venv, virtualenv, pipenv
  • Tips for working with Red Hat Software Collections
  • How to use Python virtual environments so you can safely do pip installs that are isolated and reproducible
Rob T.
  • 386
  • 3
  • 5