无法从python中的模块导入函数

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

我正在使用此代码。

from azlyrics import artists
print(artists("O"))

在名为“ azlyrics”的模块中,明确定义了“艺术家”功能。但我收到此错误。

Traceback (most recent call last): File "C:\Users\user\Desktop\python\eminem\New folder\azlyrics-master\examples\get_artists.py", line 1, in <module> from azlyrics import artists ImportError: cannot import name 'artists' from 'azlyrics' (C:\Users\user\AppData\Local\Programs\Python\Python37\lib\site-packages\azlyrics\__init__.py)

可能是什么问题?

python python-import
1个回答
0
投票

向我们显示您的文件树。

azlyrics.py与您当前正在使用的脚本位于同一目录中吗?

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