无法导入urllib.request和urllib.parse

Leg*_*sta 4 python import import-libraries

我将不胜感激任何帮助.我使用Python 3.4.1并尝试导入urllib.request和urllib.parse.没有成功.我总是收到:

Traceback (most recent call last):
  File "<frozen importlib._bootstrap>", line 2218, in _find_and_load_unlocked
AttributeError: 'module' object has no attribute '__path__'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:/Users/x/Documents/PROGRAMING and MODELING/Phyton/find cure words/importowanie.py", line 1, in <module>
    import urllib.parse
  File "C:/Users/x/Documents/PROGRAMING and MODELING/Phyton/find cure words\urllib.py", line 1, in <module>
    import urllib.request
ImportError: No module named 'urllib.request'; 'urllib' is not a package
Run Code Online (Sandbox Code Playgroud)

我想问题是导入但我不知道如何绕过它

Sai*_*kar 10

没有实际的代码,我猜测基于我过去的经验与这样的错误.

我想你要导入urllib.parse一个名为文件importowanie.pyC:/Users/x/Documents/PROGRAMING and MODELING/Phyton/find cure words.当Python尝试按名称导入模块时urllib,它首先检查您尝试导入的同一文件夹.在您的情况下,它会看到urllib在您尝试导入它的同一文件夹中调用了一个模块.它看到内部的模块而不是"真正的"urllib.因为它看到你内部没有任何称为parseurllib内容会引发错误.这是因为一个名为文件urllib.pyC:/Users/x/Documents/PROGRAMING and MODELING/Phyton/find cure words.

所以解决方案是urllib将上面的目录重命名为其他内容并重试.