Resolve issues between Python and Linux with virtualenv

Resolve issues between Python and Linux with virtualenv

771
0

Developers and system administrators need to use Python and Linux together while these two versions of Python are available. The best path for many IT organizations is to run version 2.x and 3.x at the same time on a system.
Linux and Python run into messy situations due to the two versions. To illustrate, the request which python on a new Ubuntu server yields the response:
/usr/bin/python
The Ubuntu server runs Python 2. An admin can install Python 3 in addition and use Python 3. To run a Linux system with Python 3, always include python3 instead of python, or create an alias that points to python3 or a soft link that enables the user simply to type python.
When users install Python packages, they go into two folders, depending on whether they use the package manager pip2 or pip3.
Put the wrong version of Python into the wrong folder on the Linux box, and you can end up with an unrecoverable situation .
An admin might drill down and try to install the Depends on packages in an attempt to fix the situation, but that can create a further mess (see Figure 2). Admins typically fix broken dependencies via sudo apt-get install -f, but this method is usually ineffective with Python and Linux.
To resolve Python and Linux problems, install the virtualenv Python environment isolation tool. Virtualenv creates multiple Python environments for multiple users. It works by installing Python 2 and Python 3 binaries in the target folder, which is preferably the user’s home folder. Then, it installs Python packages in (target folder)/lib. It also can share system wide packages.

Source: https://searchitoperations.techtarget.com/tutorial/Resolve-issues-between-Python-and-Linux-with-virtualenv
Submitted by: Arnfried Walbrecht

NO COMMENTS

LEAVE A REPLY