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:

  1. Update the system software package.
sudo yum update
  1. Install Python 3 and relevant software packages.
sudo yum install epel-release
sudo yum install python36 python36-devel
  1. 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.

  1. Activate the virtual environment.
source myenv/bin/activate
  1. 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
Leave a Reply 0

Your email address will not be published. Required fields are marked *


广告
Closing in 10 seconds
bannerAds