How to set up a Python 3 environment in CentOS 7
To set up a Python 3 environment on CentOS 7, you can follow these steps:
- Update the system software package.
sudo yum update
- Install Python 3 and relevant software packages.
sudo yum install epel-release
sudo yum install python36 python36-devel
- Set up a Python 3 virtual environment.
python3.6 -m venv myenv
This will create a Python 3 virtual environment called “myenv” in the current directory.
- Activate the virtual environment.
source myenv/bin/activate
- Confirm that you are using Python 3:
python --version
The output should display the version number of Python 3.
You have now successfully set up the Python 3 environment. You can install any Python package within the virtual environment and start developing applications. Once you’re done, you can deactivate the virtual environment using the following command.
deactivate