简体   繁体   English

ImportError: 无法从 'urllib' (/usr/lib/python3.7/urllib/__init__.py) 导入名称 'quote'

[英]ImportError: cannot import name 'quote' from 'urllib' (/usr/lib/python3.7/urllib/__init__.py)

i am using praat from parselmouth in gooogle colab and i am getting this error when importing from parselmouth.praat import call我在 gooogle colab 中使用来自 parselmouth 的 praat,从 parselmouth.praat 导入调用导入时出现此错误

/usr/local/lib/python3.7/dist-packages/parselmouth/adapters/dfp/interface.py in <module>()
     15 from datetime import timedelta
     16 from pytz import timezone
---> 17 from urllib import quote
     18 
     19 # Parselmouth Imports

ImportError: cannot import name 'quote' from 'urllib' (/usr/lib/python3.7/urllib/__init__.py)

i tried installing diffirent version of urllib but nothing worked我尝试安装不同版本的 urllib 但没有任何效果
i know that urllib uses import urllib.parse.quote instead of from urllib import quote but i am not the one importing the urllib package it s the praat module and i cannot change it我知道 urllib 使用import urllib.parse.quote而不是from urllib import quote但我不是导入 urllib package 的人,它是 praat 模块,我无法更改它

I had the same problem and I fixed it by running pip uninstall parselmouth , then pip install praat-parselmouth我有同样的问题,我通过运行pip uninstall parselmouth修复它,然后pip install praat-parselmouth

Some info here 这里有一些信息

Also see this Github issue另请参阅此Github 问题

If you look at the urllib documentation , you'll find that the quote() function is part of the urllib.parse module.如果您查看urllib文档,您会发现quote() function 是urllib.parse模块的一部分。 Thus:因此:

from urllib.parse import quote

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Windows Ubuntu Bash shell 上的 Python3.7 导入错误:无法从 &#39;urllib.request&#39; (/usr/lib/python3.7/urllib/request.py) 导入名称 &#39;HTTPSHandler&#39; - Python3.7 on Windows Ubuntu Bash shell ImportError: cannot import name 'HTTPSHandler' from 'urllib.request' (/usr/lib/python3.7/urllib/request.py) ImportError:无法从“变压器”(/usr/local/lib/python3.7/dist-packages/transformers/__init__.py)导入名称“BigBirdTokenizer” - ImportError: cannot import name 'BigBirdTokenizer' from 'transformers' (/usr/local/lib/python3.7/dist-packages/transformers/__init__.py) 导入错误:无法从“neo4j.v1”(/usr/local/lib/python3.7/site-packages/neo4j/v1/__init__.py)导入名称“CypherError” - ImportError: cannot import name 'CypherError' from 'neo4j.v1' (/usr/local/lib/python3.7/site-packages/neo4j/v1/__init__.py) ImportError:无法从“utils”(/usr/local/lib/python3.7/dist-packages/utils/__init__.py)导入名称“translate_sentence” - ImportError: cannot import name 'translate_sentence' from 'utils' (/usr/local/lib/python3.7/dist-packages/utils/__init__.py) Django2.1.7 导入错误:无法从 &#39;django.forms&#39; (/Users/lib/python3.7/site-packages/django/forms/__init__.py) 导入名称 &#39;util&#39; - Django2.1.7 ImportError: cannot import name 'util' from 'django.forms' (/Users/lib/python3.7/site-packages/django/forms/__init__.py) ImportError:无法从“集合”(/usr/lib/python3.10/collections/__init__.py)导入名称“序列” - ImportError: cannot import name 'Sequence' from 'collections' (/usr/lib/python3.10/collections/__init__.py) 导入错误:无法从“distutils”(/usr/lib/python3.8/distutils/__init__.py)导入名称“sysconfig” - ImportError: cannot import name 'sysconfig' from 'distutils' (/usr/lib/python3.8/distutils/__init__.py) 无法导入模块“lambda_function”:无法从“ctypes”(/var/lang/lib/python3.7/ctypes/__init__.py)导入名称“WinDLL” - Unable to import module 'lambda_function': cannot import name 'WinDLL' from 'ctypes' (/var/lang/lib/python3.7/ctypes/__init__.py import MySQLdb报错ImportError: cannot import name &#39;_mysql&#39; from &#39;MySQLdb&#39; (D:\\python\\lib\\site-packages\\MySQLdb\\__init__.py) - import MySQLdb报错ImportError: cannot import name '_mysql' from 'MySQLdb' (D:\python\lib\site-packages\MySQLdb\__init__.py) Python:ImportError: cannot import name 'Mapping' from 'collections' (C:\Program Files\Python310\lib\collections\__init__.py) - Python : ImportError: cannot import name 'Mapping' from 'collections' (C:\Program Files\Python310\lib\collections\__init__.py)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM