使colab使用库的最新安装 [英] Make colab use the latest installation of a library

查看:77
本文介绍了使colab使用库的最新安装的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正尝试使用sklearn的最新版本,从其github安装它,如下图的第2行所示.第5行从此版本的sklearn导入了一些功能.此行在我的本地计算机上有效,而在Google Colab上不可用.我是否缺少一些提示,以提示该工具使用的是最新安装的版本,而不是其缓存的版本?

I am trying to use the bleeding edge version of sklearn installing it from their github as shown on line 2 in the below image. Line 5 imports some functions from this version of sklearn. This line works in my local and not on Google Colab. Am I missing something to hint the tool to use the latest installed version and not its cached version?

推荐答案

我不确定为什么会发生这种情况,但是如果您在安装最新的开发人员之前先卸载scikit-learn,它将起作用:

I am not sure why that's happening but if you uninstall scikit-learn before installing the latest dev, it would work:

[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'

这篇关于使colab使用库的最新安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆