Python 什么';怎么了?初始化模块';pyperclip';没有属性';粘贴&x27;(很可能是由于循环进口)
我的代码附带了输出,因此面临输出问题Python 什么';怎么了?初始化模块';pyperclip';没有属性';粘贴&x27;(很可能是由于循环进口),python,python-3.x,python-2.7,Python,Python 3.x,Python 2.7,我的代码附带了输出,因此面临输出问题 import webbrowser, sys, pyperclip if len(sys.argv) > 1: #Get address from command line. address = ' '.join(sys.argv[1:]) else: #Get address from clipboard. address = pyperclip.paste
import webbrowser, sys, pyperclip
if len(sys.argv) > 1:
#Get address from command line.
address = ' '.join(sys.argv[1:])
else:
#Get address from clipboard.
address = pyperclip.paste()
webbrowser.open('https://www.google.com/maps/place/' + address)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Output: text = pyperclip.paste()
AttributeError: partially initialized module 'pyperclip' has no attribute 'paste' (most likely due to a circular import)
代码是正确的,但pyperclip.py文件存在于同一目录中,稍后将删除该文件,并且能够获得预期的输出 这段代码是否如图所示完整,还是其他模块导入了它?这是一段完整的代码,我已经安装了pip3和必要的模块,但输出时出现错误。为什么我不明白?此代码保存为什么文件名?它保存为试用版。py错误消息引用了行
text=pyperclip.paste()
,但您的代码有address=pyperclip.paste()
,因此这不是您的实际代码。请张贴您的实际代码。