【发布时间】:2014-06-09 06:46:37
【问题描述】:
如果有任何帮助,我将不胜感激。我使用 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
我猜是导入的问题,但我不知道如何解决它
【问题讨论】:
-
你确定你使用的是 Python 3 吗?
-
您是否将文件命名为
urllib.py? -
Python 3.4.1 (v3.4.1:c0e311e010fc, May 18 2014, 10:38:22) [MSC v.1600 32 bit (Intel)] on win32 输入“copyright”,“credits”或“license()”了解更多信息。 >>>
-
而且文件不是urllib.py
-
您应该查看请求。比 urllib 更容易使用。 docs.python-requests.org/en/latest
标签: python import import-libraries