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

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

打开Internet

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

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

Collecting torch-geometric
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘NewConnectionError(’<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f28a73aa9e8>: 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

发布了19 篇原创文章 · 获赞 29 · 访问量 3万+

猜你喜欢

转载自blog.csdn.net/qq_41987033/article/details/96989147