Jupyter Notebook中安装第三方库

pip 可以在所有环境下安装python包。
conda 可以在conda环境下安装所有包。
通用安装方式:

# Install a conda package in the current Jupyter kernel
import sys
!conda install --yes --prefix {
    
    sys.prefix} numpy

这些增加的内容确保了conda能在当前运行的Jupyter核内安装这个包。

# Install a pip package in the current Jupyter kernel
import sys
!{
    
    sys.executable} -m pip install numpy

增加的内容确保了你在使用与当前Python核相关的pip版本,因此你所安装的包能在当前notebook中使用。

猜你喜欢

转载自blog.csdn.net/david2000999/article/details/121382030
今日推荐