Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/290.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 什么';怎么了?初始化模块';pyperclip';没有属性';粘贴&x27;(很可能是由于循环进口)_Python_Python 3.x_Python 2.7 - Fatal编程技术网

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()
,因此这不是您的实际代码。请张贴您的实际代码。