繁体   English   中英

来自GCP实例的jupyter笔记本无法导入wget或fastai

[英]jupyter notebook from GCP instance not able to import wget or fastai

我有一个在Google云端平台上运行的VM实例。 我按照此处的说明进行操作: https ://towardsdatascience.com/running-jupyter-notebook-in-google-cloud-platform-in-15-min-61e16da34d52为该实例设置Jupyter笔记本。 如果我打开python3笔记本,我可以导入某些软件包(例如matplotlib),但是由于某种原因,如果我尝试导入wget或fastai,我会收到

ImportError:没有名为“ fastai”的模块

要么

ImportError:没有名为“ wget”的模块

该实例是一个预构建的pytorch深度学习设置,该设置应该与fastai一起提供,并且wget在进行任何类型的安装之前都可以在SSH终端中运行。 我已经尝试使用conda和pip命令安装wget和fastai,但是都无法在jupyter中访问这些模块。 我假设由于这些模块是在此实例中预先构建的,因此我需要以某种方式访问​​/导入它们吗?

如果在SSH终端中(未安装任何conda / pip),请问whereis wget ,我收到:

wget:/ usr / bin / wget / opt / anaconda3 / bin / wget /usr/share/man/man1/wget.1.gz /usr/share/info/wget.info.gz

如果在SSH终端中(未安装任何conda / pip),请问whereis fastai ,我收到:

Fastai:

如何使导入工作?

import fastai
import wget

如果在我的Jupyter笔记本中运行:

!pip install wget
import wget

我得到:

/home/me/anaconda3/lib/python3.5/site-packages/pip/_vendor/requests/ init .py:83:RequestsDependencyWarning:加密技术的旧版本([1、3])可能会导致速度变慢。 warnings.warn(警告,RequestsDependencyWarning)的要求已得到满足:/home/me/anaconda3/lib/python3.5/site-packages(3.2)中的wget ----------------- -------------------------------------------------- -------- ImportError Traceback(最近一次呼叫最近)在4 import yaml 5 get_ipython()。system('pip install wget')----> 6 import wget

ImportError:没有名为“ wget”的模块

快速更新:wget和fastai已经安装似乎确实有些问题。 我无法导入,但是可以在jupyter笔记本中使用这些模块。 所以wget.download(stuff)引发了

NameError:名称“ wget”未定义错误

但是!wget.download(stuff)可以工作。

还是希望能够导入。 但是,照原样,有没有办法引用fastai基类? 现在如果我尝试

class newClass(LearnerCallback):
    new stuff

我得到:

NameError:未定义名称“ LearnerCallback”

我认为这是由于未导入的fastai。 我该如何解决?

尝试使用:

%conda install wget fastai

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM