Google Colab not updating package?

这一生的挚爱 提交于 2019-12-10 13:50:03

问题


I am trying to use seaborn==0.8.1 in an ipynb on Google colab. Here is my code:

"""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__)

However, this outputs the following:

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

If the requirement is satisfied why am I importing the old version of Seaborn?


回答1:


The issue here is that Colab imports seaborn at startup, before you've pip install'd the new version. If you restart your runtime after the install, you'll pick up the new version.




回答2:


!pip install seaborn --upgrade packageName and then restart the kernel/runtime.

If you just need to upgrade seaborn in a hosted collab notebook to the latest version then run !pip install seaborn --upgrade and then restart the kernel/runtime.



来源:https://stackoverflow.com/questions/51226306/google-colab-not-updating-package

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!