在Kaggle上安装自定义第三方库

如果你在使用Kernel时想用某个第三方库,但是kaggle上的默认环境没有,可以用下面的方法进行安装(以第三方库torch-geometric为例):

打开Internet

在Kernel的右边侧栏有设置区域,如图所示,让Internet这一选项置为on

在Kaggle上安装自定义第三方库_第1张图片

如果没开就进行安装会出现如下的错误:

Collecting torch-geometric
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘NewConnectionError(’: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution’,)’: /simple/torch-geometric/




ERROR: Could not find a version that satisfies the requirement torch-geometric (from versions: none)
ERROR: No matching distribution found for torch-geometric

在code单元中用pip安装

在Kernel中的code单元中输入如下命令

!pip install torch-geometric

注意前面的感叹号不能省略,等待其安装完毕。

Collecting torch-geometric
Downloading https://files.pythonhosted.org/packages/cc/b2/19eca95445f4657d6f164e3b57342f138780cca2b4a96a7f1a80707d778a/torch_geometric-1.3.0.tar.gz (102kB)
|████████████████████████████████| 112kB 2.8MB/s eta 0:00:01




Installing collected packages: plyfile, isodate, rdflib, torch-geometric
Successfully installed isodate-0.6.0 plyfile-0.7 rdflib-4.2.2 torch-geometric-1.3.0

你可能感兴趣的:(在Kaggle上安装自定义第三方库)