pyenv,virtualenv,anaconda有什么区别? [英] What is the difference between pyenv, virtualenv, anaconda?

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

问题描述

我是一个试图学习python的红宝石程序员.我很喜欢pyenv,因为它就像是rbenv的副本和粘贴一样. Pyenv帮助在系统中拥有多个版本的python,并且无需隔离系统的敏感部分即可隔离python.

I am a ruby programmer trying to learn python. I am pretty family with pyenv since it is like a copy and paste from rbenv. Pyenv helps allow to have more than one version of python in a system and also to isolate the python without touching sensitive part of system.

我想每个python安装都带有pip包.我仍然不明白的是,有很多好的python库建议使用此virtualenv和anaconda.我什至可以找到pyenv的virtualenv插件.

I suppose every python installation come with pip package. What I still don't understand is, there are many good python libs out there that suggest to use this virtualenv and anaconda. I can even find virtualenv plugin for pyenv.

现在,我对这两个pyenv和virtualenv的用途感到困惑. pyenv中更糟糕的是有一个virtualenv插件.

Now I am getting confused with the purpose of these two pyenv and virtualenv. worse inside pyenv there is a virtualenv plugin.

我的问题是:

  • pyenv和virtualenv有什么区别?
  • 在pyenv和virtualenv中使用pip命令有什么区别吗?
  • 这个pyenv virutalenv做什么?

您对示例的解释将不胜感激.

your explanation with example will be highly appreciated.

推荐答案

这里也值得一提pip,因为condapip具有与此主题相关的异同.

It's worth mentioning pip here as well, as conda and pip have similarities and differences that are relevant to this topic.

pip:Python软件包管理器.

  • 您可能会认为pip是ruby gem命令的python等效版本
  • 默认情况下,
  • pip不包含在python中.
  • 您可以使用 homebrew 安装Python ,它将自动安装pip:brew install python
  • 默认情况下,OSX的最终版本不包含pip.要将pip添加到Mac系统的python版本中,您可以sudo easy_install pip
  • 您可以使用 PyPI:Python软件包索引来查找和发布python软件包
  • requirements.txt文件可与ruby gemfile
  • 媲美
  • 要创建需求文本文件,pip freeze > requirements.txt
  • 请注意,目前,我们已在系统上安装了python,并创建了requirements.txt文件,其中概述了系统上已安装的所有python软件包.
  • You might think of pip as the python equivalent of the ruby gem command
  • pip is not included with python by default.
  • You may install Python using homebrew, which will install pip automatically: brew install python
  • The final version of OSX did not include pip by default. To add pip to your mac system's version of python, you can sudo easy_install pip
  • You can find and publish python packages using PyPI: The Python Package Index
  • The requirements.txt file is comparable to the ruby gemfile
  • To create a requirements text file, pip freeze > requirements.txt
  • Note, at this point, we have python installed on our system, and we have created a requirements.txt file that outlines all of the python packages that have been installed on your system.

pyenv:Python版本管理器

  • 从文档中: pyenv可让您轻松在多个版本的Python之间切换.它简单,简单,遵循UNIX的一站式工具的传统,可以很好地完成一件事.该项目是从rbenv和ruby-build派生的,并针对Python进行了修改.
  • 许多人非常喜欢使用python3 .
  • 如果您需要使用不同版本的python,请使用pyenv轻松进行管理.
  • From the docs: pyenv lets you easily switch between multiple versions of Python. It's simple, unobtrusive, and follows the UNIX tradition of single-purpose tools that do one thing well. This project was forked from rbenv and ruby-build, and modified for Python.
  • Many folks hesitate to use python3.
  • If you need to use different versions of python, pyenv lets you manage this easily.

virtualenv:Python环境管理器.

  • 从文档中:要解决的基本问题是依赖项和版本和间接权限.假设您有一个需要LibFoo版本1的应用程序,但是另一个应用程序需要版本2.如果将所有内容都安装到/usr/lib/python2.7/site-packages(或平台的标准位置是什么)中,那么很容易在无意中升级不应升级的应用程序的情况下结束.
  • 要创建virtualenv,只需调用virtualenv ENV,其中ENV是放置新虚拟环境的目录.
  • 要初始化virtualenv,您需要source ENV/bin/activate.要停止使用,只需调用deactivate.
  • 激活virtualenv后,可以通过对项目的requirements.txt文件运行pip install -r来安装工作区的所有程序包要求.
  • From the docs: The basic problem being addressed is one of dependencies and versions, and indirectly permissions. Imagine you have an application that needs version 1 of LibFoo, but another application requires version 2. How can you use both these applications? If you install everything into /usr/lib/python2.7/site-packages (or whatever your platform’s standard location is), it’s easy to end up in a situation where you unintentionally upgrade an application that shouldn’t be upgraded.
  • To create a virtualenv, simply invoke virtualenv ENV, where ENV is is a directory to place the new virtual environment.
  • To initialize the virtualenv, you need to source ENV/bin/activate. To stop using, simply call deactivate.
  • Once you activate the virtualenv, you might install all of a workspace's package requirements by running pip install -r against the project's requirements.txt file.

Anaconda:程序包管理器+环境管理器+其他科学图书馆.

  • 从文档中: Anaconda 4.2.0包括易于安装的Python(2.7.12、3.4.5和/或3.5.2)以及100多种经过预先构建和测试并经过科学和分析的Python软件包的更新,其中包括NumPy,Pandas,SciPy,Matplotlib和IPython,另外还有620多种软件包可通过简单的conda install <packagename>
  • 获得
  • 作为一名Web开发人员,我没有使用Anaconda.包括所有软件包在内,约为3GB.
  • 有一个精简的miniconda版本,尽管我没有亲自使用它的经验,但它似乎比使用pip + virtualenv更简单.
  • 虽然conda允许您安装软件包,但这些软件包与PyPI软件包是分开的,因此根据您需要安装的软件包的类型,您可能仍需要额外使用pip.
  • From the docs: Anaconda 4.2.0 includes an easy installation of Python (2.7.12, 3.4.5, and/or 3.5.2) and updates of over 100 pre-built and tested scientific and analytic Python packages that include NumPy, Pandas, SciPy, Matplotlib, and IPython, with over 620 more packages available via a simple conda install <packagename>
  • As a web developer, I haven't used Anaconda. It's ~3GB including all the packages.
  • There is a slimmed down miniconda version, which seems like it could be a more simple option than using pip + virtualenv, although I don't have experience using it personally.
  • While conda allows you to install packages, these packages are separate than PyPI packages, so you may still need to use pip additionally depending on the types of packages you need to install.

另请参见:

  • conda vs pip vs virtualenv (section in documentation from anaconda)
  • the difference between pip and conda (stackoverflow)
  • the relationship between virtualenv and pyenv (stackoverflow)

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

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