apt-get virtualenv和pip virtualenv有什么区别? [英] What's the difference between apt-get virtualenv and pip virtualenv?

查看:109
本文介绍了apt-get virtualenv和pip virtualenv有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

apt-get中的virtualenv与pip中的virtualenv有什么区别?它们可以互换吗?

What's the difference between the virtualenv from apt-get and that 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

推荐答案

在较高级别apt上,系统维护.具体地说,debian系列中的任何事物都将使用apt来管理驱动程序,编译器等需要较低级别集成的事物.

At a high-level apt is something maintained by your system. Specifically anything in the debian family will use apt to manage things like drivers, compilers, things that require lower-level integration.

这意味着对于像numpyscipy这样需要与FORTRAN库进行系统级集成的事物,包括pip依赖项实际上将无法工作.

This means for things like numpy and scipy that require system-level integration with FORTRAN libraries, including the pip dependency won't actually work.

一些与系统级依赖关系紧密链接的python软件包维护apt软件包,这些软件包可以一次为您提供完整的软件包,而无需在两者之间进行协调.缺点是,由于Canonical的审阅过程非常细致(应该如此),您将获得9/10的较低版本的库.

Some python packages that are tightly-linked with the system-level dependencies maintain apt packages that simply give you the full package all at once without having to coordinate between the two. The minus is that because Canonical's review process is pretty meticulous (as it should be) you will be getting, 9/10 a less-recent version of the library you're trying to use.

因此,简而言之:您通常需要apt软件包来启用最新的pip安装,并且虽然可以通过apt获得相同的python依赖项,但这些库通常较旧并且可能不需要功能.

So, in short: you will often require apt packages to enable more recent pip installs, and while the same python dependencies may be available via apt, these libraries are typically much older and may not have required functionality.

一个常见的解决方法是只使用其中一个软件包的系统依赖关系,而不是完整软件包.您可以使用build-deps标志来完成此操作.下面是一个常见的示例:

A common workaround is to simply use the system dependencies from one of these packages rather than the full package. You can do this by use the build-deps flag. A common example given below:

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

在virtualenv中工作时,实际上可以为您提供最新版本的scipy.

Which will actually give you the most up-to-date version of scipy while working within your virtualenv.

这篇关于apt-get virtualenv和pip virtualenv有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆