2020年10月12日 星期一

python_Note23

conda install vs pip install
conda install 與 pip install 的差別


pip : only install the package you select

conda : not only install the package you select, but also install other packages or lib that the selected package will need. For example, "conda install tensorflow-gpu" will install cudatoolkit and cudn, and only be linked in the (virtual)environment.

pip : 只安裝該package

conda 會安裝該package所需要的package,甚至lib,例如tensorflow-gpu版,會一併安裝cudatoolkit和cudnn,且只會在該環境,其他環境不會受影響。


set virtual environment for jupyter lab
設定虛擬環境給jupyter lab使用


base : conda create -n py36 python=3.6 # create new virtual environment, named py36, and python kernel =3.6

py36 : pip install ipykernel jupyterlab # change to py36 environment and install ipykernel (jupyterlab is not necessary

py36 : python -m ipykernel install --user --name py36 --display-name tf15 # install/link the py36 kernel to jupyter lab, and name it as tf15


補充:重開機後base 的tf15無法呼叫GPU,原因不明,但的確是連到tf1.15版本,而在py36就可以呼叫到GPU,一切正常。
base: jupyter lab   # 在base可以連動py36的tf15 
in base environment, jupyter lab's tf15 is linked to py36

py36 : jupyter lab # 顯示python 和 tf15,但兩個都是指向py36
in py36 environment, although jupyer lab displays tf15 and python,both 2 are linked to py36. 




沒有留言:

張貼留言