Azure ML“执行Python脚本”中的Psycopg2模块导入错误

问题描述 投票:0回答:1

我正在尝试从已构建的Postgres数据库中将数据读取到AZURE ML Studio(经典)。即使在需求file.txt中,我已经安装了psycopg2,psycopg2-binary,但是当我在Azure ML Studio的“执行Python脚本”块中导入psycopg2库时,也会得到以下错误

enter image description here

显然,它没有正确导入psycopg2模块。

Python代码-从Postgres DB中读取数据

import psycopg2

def azureml_main(dataframe1 = None, dataframe2 = None):

    conn = psycopg2.connect(database=db_name, user=user_name, password=passowrd_key, host=hostname, port=port_number)
    cur = conn.cursor()
    print('Connection Established...')

    return None, 

但是,在本地运行上述python代码时,一切正常。仅在Azure ML studio中,问题出现。

感谢您的贡献。

python postgresql psycopg2 azure-machine-learning-studio
1个回答
1
投票

[尝试使用python部署Azure ML实验时,我也遇到了同样的问题

© www.soinside.com 2019 - 2024. All rights reserved.