Google colaboratory 使colab使用最新安装的库

Google colaboratory 使colab使用最新安装的库,google-colaboratory,Google Colaboratory,我正在尝试使用sklearn的最新版本,从他们的github安装它,如下图第2行所示。第5行从这个版本的sklearn导入一些函数。这行代码在我的本地版本中有效,而不是在Google Colab上。我是否缺少提示工具使用最新安装版本而不是缓存版本的内容 我不知道为什么会发生这种情况,但如果您在安装最新开发版本之前卸载scikit learn,它将工作: [1] !pip uninstall scikit-learn -y Uninstalling scikit-learn-0.19.1: S

我正在尝试使用sklearn的最新版本,从他们的github安装它,如下图第2行所示。第5行从这个版本的sklearn导入一些函数。这行代码在我的本地版本中有效,而不是在Google Colab上。我是否缺少提示工具使用最新安装版本而不是缓存版本的内容


我不知道为什么会发生这种情况,但如果您在安装最新开发版本之前卸载scikit learn,它将工作:

[1] !pip uninstall scikit-learn -y
Uninstalling scikit-learn-0.19.1:
  Successfully uninstalled scikit-learn-0.19.1

[2]!pip install Cython
   !pip install git+git://github.com/scikit-learn/scikit-learn.git
Requirement already satisfied: Cython in /usr/local/lib/python3.6/dist-packages (0.28.2)
Collecting git+git://github.com/scikit-learn/scikit-learn.git
  Cloning git://github.com/scikit-learn/scikit-learn.git to /tmp/pip-req-build-d59ukisw
Requirement already satisfied: numpy>=1.8.2 in /usr/local/lib/python3.6/dist-packages (from scikit-learn==0.20.dev0) (1.14.3)
Requirement already satisfied: scipy>=0.13.3 in /usr/local/lib/python3.6/dist-packages (from scikit-learn==0.20.dev0) (0.19.1)
Building wheels for collected packages: scikit-learn
  Running setup.py bdist_wheel for scikit-learn ... done
  Stored in directory: /tmp/pip-ephem-wheel-cache-is88dk15/wheels/a1/50/0e/316ef2ff8d4cfade292bd20b49efda94727688a153382745a6
Successfully built scikit-learn
Installing collected packages: scikit-learn
Successfully installed scikit-learn-0.20.dev0

[3] !pip freeze | grep scikit
scikit-image==0.13.1
scikit-learn==0.20.dev0

[4] from sklearn.preprocessing import CategoricalEncoder

[5] import sklearn
    sklearn.__version__
'0.20.dev0'

我不知道为什么会发生这种情况,但如果您在安装最新的dev之前卸载scikit learn,它将起作用:

[1] !pip uninstall scikit-learn -y
Uninstalling scikit-learn-0.19.1:
  Successfully uninstalled scikit-learn-0.19.1

[2]!pip install Cython
   !pip install git+git://github.com/scikit-learn/scikit-learn.git
Requirement already satisfied: Cython in /usr/local/lib/python3.6/dist-packages (0.28.2)
Collecting git+git://github.com/scikit-learn/scikit-learn.git
  Cloning git://github.com/scikit-learn/scikit-learn.git to /tmp/pip-req-build-d59ukisw
Requirement already satisfied: numpy>=1.8.2 in /usr/local/lib/python3.6/dist-packages (from scikit-learn==0.20.dev0) (1.14.3)
Requirement already satisfied: scipy>=0.13.3 in /usr/local/lib/python3.6/dist-packages (from scikit-learn==0.20.dev0) (0.19.1)
Building wheels for collected packages: scikit-learn
  Running setup.py bdist_wheel for scikit-learn ... done
  Stored in directory: /tmp/pip-ephem-wheel-cache-is88dk15/wheels/a1/50/0e/316ef2ff8d4cfade292bd20b49efda94727688a153382745a6
Successfully built scikit-learn
Installing collected packages: scikit-learn
Successfully installed scikit-learn-0.20.dev0

[3] !pip freeze | grep scikit
scikit-image==0.13.1
scikit-learn==0.20.dev0

[4] from sklearn.preprocessing import CategoricalEncoder

[5] import sklearn
    sklearn.__version__
'0.20.dev0'