如何修复 Python 3 ModuleNotFoundError: No module named 'urlparse'
问题:
尝试在 Python 3 中使用以下命令导入 urlparse 时
import_urlparse_error.py
import urlparse你看到以下错误消息:
import_urlparse_traceback.txt
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
Input In [29], in <cell line: 1>()
----> 1 import urlparse
ModuleNotFoundError: No module named 'urlparse'解决方案
在 Python 3 中,urlparse 已重命名为 urllib.urlparse。要导入它,使用此行代替:
fix_import.py
from urllib.parse import urlparseCheck out similar posts by category:
Python
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow