What is the difference between apt-get virtualenv and pip virtualenv?

What is the difference between virtualenv from apt-get and from pip? Are they interchangeable?

apt-get install virtualenv The following extra packages will be installed: python-chardet-whl python-colorama-whl python-distlib-whl python-html5lib-whl python-pip-whl python-requests-whl python-setuptools-whl python-six-whl python-urllib3-whl python3-virtualenv The following NEW packages will be installed: python-chardet-whl python-colorama-whl python-distlib-whl python-html5lib-whl python-pip-whl python-requests-whl python-setuptools-whl python-six-whl python-urllib3-whl python3-virtualenv virtualenv 
+5
source share
3 answers

In a higher-level apt , something is supported by your system. In particular, anything in the debian family will use apt to manage things like drivers, compilers, things that need to be integrated at a lower level.

This means that for things like numpy and scipy , which require integration at the system level with FORTRAN libraries, including the pip dependency will not work.

Some python packages that are closely related to system level dependencies support apt packages that simply give you the complete package right away, without the need to coordinate between them. The downside is that since the canonical review process is quite meticulous (as it should be), you will get a 9/10 less recent version of the library that you are trying to use.

So, in short: you often need apt packages to enable later pip installations, and although the same python dependencies may be available through apt , these libraries are usually much older and may not require functionality.

A common solution is to simply use the system dependencies from one of these packages, not the complete package. You can do this using the build-deps flag. A general example is given below:

 apt-get build-dep python-scipy pip install scipy 

Which will actually give you the latest version of scipy while working in your virtualenv.

+8
source

apt or apt-get - install similar installer distributions and install packages in the /usr/lib/python2.7/dist-packages directory.

pip install - the python package manager and install the packages in the /usr/local/lib/python2.7/dist-packages directory

Both directories are on the path to python that it is looking for import modules.

 >>> import sys >>> sys.path ['/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/gtk-2.0', '/usr/lib/pymodules/python2.7'] 
+3
source

They use separate repositories, you can check which versions you get from pip through here . As for apt-get , you will need to check the package manager version and the source list of your operating system to see which versions you get from there.

+1
source

Source: https://habr.com/ru/post/1240871/


All Articles