
Once the text file opens up in our terminal window, we will have to type i to enter insert mode, and then we can write our first program print("Hello, Welcome!") Here myenv is active that means when we create programs here they will use only this particular environment’s settings and packages.Ĭreate sample program (myenv) myenv]# vi hello.py

It will promt you with the name of your environment like below (myenv) myenv]# To use this environment, you need to activate it by typing following command myenv]# source bin/activate You can create virtual environment with following command environment]# python3.7 -m venv myenv Each environment is basically a directory or folder in your computer that has a few scripts in it to make it act as an environment.Ĭreate new directory with mkdir ~]# mkdir ~]# cd environment You can set up as many Python programming environments as you want. Virtual environments enable you to have an isolated space on your computer for Python projects, ensuring that each of your projects can have its own set of dependencies that won’t disrupt any of your other projects. Successfully installed pip-19.0.3 setuptools-40.8.0 Sample output Installing collected packages: setuptools, pip If you use the normal "make install" you will end up with two different versions of Python in the filesystem both named python.so altinstall is used to prevent replacing the default python binary file /usr/bin/python When you install your custom version of Python. configure Python-3.7.4]# make altinstall Use below commands to compile source code by using altinstall ~]# cd Python-3.7.4]#. This Python installation required GCC compiler on your system.install prerequisites for Python before installing it ~]# yum install gcc openssl-devel bzip2-devel ~]# yum groupinstall "Development Tools"ĭownload python 3.7 ~]# cd src]# src]# tar -xvzf Python-3.7.4.tgz Python 3.6.8 compiling 3.7 from source code

Now install python with pip ~]# yum install python36u python36u-libs python36u-devel python36u-pip In order to have the latest version of Python, the user will have to install it manually.īy default centos is having python version of 2.7įirst we will install python3.6 from repository ~]# yum install However, the pre-installed version of Python found on CentOS 7 is a much older version.

Python is a general-purpose object-oriented programming language designed to be used as a software solution for almost all kinds of problems.
