問題描述
我安裝了新的 anaconda v4.4.我意識到可以使用 conda 和 pip 安裝 python 包.使用anaconda時使用pip安裝python包而不是conda有什么效果?pip 安裝的庫會停止運(yùn)行嗎?我正在使用 python v3
I have installed a fresh anaconda v4.4. I realized that python packages can be installed using both conda and pip. What is the effect of using pip to install python packages instead of conda when using anaconda? Will the pip-installed libraries cease to function? I am using python v3
我不認(rèn)為這個問題與 重復(fù)pip 和 conda 有什么區(qū)別?該問題解釋了 pip 和 conda 之間的區(qū)別,但沒有談?wù)撛诳梢允褂?conda 時使用 pip 的效果.
I don't think the question is a duplicate of What is the difference between pip and conda? That question explains the difference between pip and conda but does not talk about the effect of using pip when conda can be used.
推薦答案
如果你使用 pip
安裝 vs conda
,一切都可能繼續(xù)工作.但是,Conda 無法管理 pip
已安裝的依賴項 - 它無法升級或刪除它們.更重要的是,conda 會安裝一個包即使它已經(jīng)用 pip
安裝了!試試這個測試:
Everything might keep working if you use pip
to install vs conda
. However, Conda cannot manage dependencies that pip
has installed - it cannot upgrade them, or remove them. More importantly, conda will install a package even if its already been installed with pip
! Try this test:
conda create -n testenv python=3
conda activate testenv
pip install numpy
conda install scipy
您將從第三個命令中看到 conda 想要重新安裝 NumPy,即使它已經(jīng)使用 pip
安裝.如果存在鏈接不同的 C 庫或類似的東西,這可能會導(dǎo)致問題.一般來說,只要有可能,就使用 conda 將軟件包安裝到 conda 環(huán)境中.
You will see from the third command that conda will want to re-install NumPy, even though it has already been installed with pip
. This can cause problems if there are C libraries whose linking is different, or something like that. In general, whenever possible, use conda to install packages into conda environments.
這篇關(guān)于anaconda上使用pip安裝python包有什么效果?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!