pip和conda到底有什么不一樣?


今天看到我的foreman開始報錯去詢問才發現。我們的python包管理工具已經從pip整體遷移到了conda。。最近的遷移真的非常多。。前端也在遷移打包🔧。

跟着發的教程弄了半天總算搞定,但是我非常疑惑。

為什么疑惑。。因為既然都是關於python的包管理工具為什么有了pip 我們還需要conda?在stackoverflow上搜到了答案 所以。我只做中文搬運 不做過多的污染

 

Having been involved in the python world for so long, we are all aware of pip, easy_install, and virtualenv, but these tools did not meet all of our specific requirements. The main problem is that they are focused around Python, neglecting non-Python library dependencies, such as HDF5, MKL, LLVM, etc., which do not have a setup.py in their source code and also do not install files into Python’s site-packages directory.
So Conda is a packaging tool and installer that aims to do more than what pip does; handle library dependencies outside of the Python packages as well as the Python packages themselves. Conda also creates a virtual environment, like virtualenv does. As such, Conda should be compared to Buildout perhaps, another tool that lets you handle both Python and non-Python installation tasks. Because Conda introduces a new packaging format, you cannot use pip and Conda interchangeably; pip cannot install the Conda package format. You can use the two tools side by side but they do not interoperate either.

在python的世界里也浸淫多年了,我們早已習慣有 pip ,easy_install 和virtualenv的世界,但是這些🔧沒有解決我們所有的需求哦。這其中主要的問題是他們全部都集中解決關於python相關問題而忽略了非python庫的依賴關系。(這句我沒他看明白),就像 HDF5, MKL LLVM,etc等,在他們的源碼中並沒有setup.py這種東西而且也沒有安裝文件在python的site-packages 目錄中。

所有conda就是一個包管理🔧和安裝🔧,他就是要做比pip更多的事情;在python-site-packages之外管理python 庫依賴關系。 而且conda同樣也像virtualenv一樣創建一個虛擬環境。

conda可以讓你同時管理安裝處理你有關python的任務和跟python無關的任務

conda使用了一個新的包格式,你不能交替使用pip 和conda。因為pip不能安裝和解析conda的包格式。你可以使用兩個工具 但是他們是不能交互的。

另外我個人由於經常忘記conda環境的啟動命令也在這里記錄一下
啟動
source activate xxx

關閉
source deactivate

更新
conda env update -f environment.yml 更新配置文件

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM