Google Colab 没有更新包?

Google Colab not updating package?

我正在尝试在 Google colab 上的 ipynb 中使用 seaborn==0.8.1。这是我的代码:

"""General import statements and settings config."""
!pip install seaborn==0.8.1
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
%matplotlib inline
pd.set_option('max_columns', 10)
color = sns.color_palette()[0]
print (sns.__version__)

但是,这会输出以下内容:

Requirement already satisfied: seaborn==0.8.1 in /usr/local/lib/python3.6/dist-packages (0.8.1)
0.7.1

如果满足要求,为什么我要导入旧版本的 Seaborn?

这里的问题是,在您 pip install 新版本之前,Colab 在启动时导入了 seaborn。如果您在安装后重新启动运行时,您将选择新版本。

!pip install seaborn --upgrade packageName然后重启kernel/runtime.

如果您只需要将托管协作笔记本中的 seaborn 升级到最新版本,那么 运行 !pip install seaborn --upgrade 然后重启 kernel/runtime.