简体   繁体   English

怎样才能在Azure ML中导入某些python库?

[英]How can certain python libraries be imported in azure ML?Like the line import humanfriendly gives error

In execute python module. 在执行python模块。 The line 线

import humanfriendly

gives error. 给出错误。 How to fix this? 如何解决这个问题?

Your description is not clear, I don't know what happended when you got error via import humanfriendly as you said. 您的描述不清楚,我不知道您所说的通过import humanfriendly出错时发生了什么。 So I just can do for you that only post my steps about how to install humanfriendly Python package in Azure ML, as below. 因此,我可以为您做的只是发布有关如何在Azure ML中安装humanfriendly Python软件包的步骤,如下所示。

  1. According to the section Technical Notes of the document "Execute Python Script", I download the humanfriendly package from here . 根据文档“ Execute Python Script”的“ Technical Notes ”部分,我从此处下载了humanfriendly软件包。 I decompressed the package (the same for either .whl file or .tar.gz file), and package its humanfriendly directory as a zip file. 我解压缩了该包( .whl文件或.tar.gz文件相同),并将其humanfriendly目录打包为zip文件。
  2. Then I click the botton +New and select the DATASET tab to Upload a new dataset from a local file, as the figures below. 然后单击botton +New然后选择DATASET选项卡以从本地文件上载新数据集,如下图所示。

    Fig 1. Click the botton +New 图1.单击botton +New 在此处输入图片说明 Fig 2. Select the tab DATASET 图2.选择选项卡DATASET 在此处输入图片说明 Fig 3. Upload a new dataset from a local file 图3.从本地文件上传新的数据集 在此处输入图片说明

  3. Drag & drop the dataset module humanfriendly.zip and a Execute Python Script module to connect them and write the Python code, as below. 拖放数据集模块humanfriendly.zip和“ Execute Python Script模块以连接它们并编写Python代码,如下所示。

在此处输入图片说明

Here is My testing code in the Execute Python Script . 这是我在Execute Python Script中的测试代码。

import humanfriendly

def azureml_main(dataframe1 = None, dataframe2 = None):
    user_input = '16G'
    num_bytes = humanfriendly.parse_size(user_input)
    print num_bytes

Finally, I ran the experiment successfully. 最后,我成功进行了实验。


Update: The file structure tree of my humanfriendly zip. 更新:我的humanfriendly zip的文件结构树。 I decompressed the wheel file and just package the humanfriendly directory. 我解压了wheel文件,只打包了humanfriendly目录。

humanfriendly
├── data.csv
└── humanfriendly
    ├── cli.py
    ├── compat.py
    ├── __init__.py
    ├── prompts.py
    ├── sphinx.py
    ├── tables.py
    ├── terminal.py
    ├── tests.py
    ├── text.py
    └── usage.py

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

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