[英]Import own Python module on Kaggle
I am new to this and very new to Kaggle.我对此很陌生,对 Kaggle 也很陌生。
I am trying to replicate this notebook:我正在尝试复制此笔记本:
https://www.kaggle.com/bibhash123/chest-x-ray-abnormalities-baseline-tf-keras https://www.kaggle.com/bibhash123/chest-x-ray-abnormalities-baseline-tf-keras
There one person wrote a module from utilities_x_ray
有一个人
from utilities_x_ray
写了一个模块
https://www.kaggle.com/bibhash123/utilities-x-ray https://www.kaggle.com/bibhash123/utilities-x-ray
How to import it?如何导入? It looks like
utilities_x_ray
is not directly specified in the second link.看起来
utilities_x_ray
没有在第二个链接中直接指定。
As a result, I get an error结果,我得到一个错误
ERROR: Could not find a version that satisfies the requirement utilities_x_ray
ERROR: No matching distribution found for utilities_x_ray
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-14-79d7808e32c5> in <module>
11 import matplotlib.pyplot as plt
12 get_ipython().system('pip install utilities_x_ray')
---> 13 import utilities_x_ray
14 from utilities_x_ray import read_xray,showXray
15 from tqdm import tqdm
ModuleNotFoundError: No module named 'utilities_x_ray'
You do not need to pip install
the utility file.您不需要
pip install
实用程序文件。 Rather, just include the utilities_x_ray.py
file in the same directory that you run the python notebook.相反,只需将
utilities_x_ray.py
_x_ray.py 文件包含在运行 python 笔记本的同一目录中。
The python notebook looks for files within the same directory whenever importing as well as those modules that were installed via pip
. python 笔记本在导入时会在同一目录中查找文件以及通过
pip
安装的那些模块。
You need to copy the script content from https://www.kaggle.com/bibhash123/utilities-x-ray into your working directory and save it as utilities_x_ray.py Hope this w'll be helpfull您需要将脚本内容从https://www.kaggle.com/bibhash123/utilities-x-ray 复制到您的工作目录并保存为实用程序_x_ray.py 希望这会有所帮助
You should consider downloading both the chest-x-ray-abnormalities-baseline-tf-keras.ipynb as您应该考虑将两个胸部 x 射线异常-基线-tf-keras.ipynb 下载为
and the utilities_x_ray.py
和实用程序_x_ray.py
Please make sure that they are into the same folder... After that, you'll need to install the pydimcom and scikit-image using pip install pydicom scikit-image
请确保它们在同一个文件夹中...之后,您需要使用 pip install pydicom scikit-image 安装 pydimcom 和 scikit-image
You can also install the packages directly from the GIt repository:您还可以直接从 GIt 存储库安装软件包:
:pip install git+https.//github.com/dkriegner/xrayutilities.git
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.