我在我的树莓派 3 上使用 gTTS(Google 文本到语音)时遇到问题。我只是做了
sudo pip3 install gTTS
安装它。但是当我运行我的代码时,我发现了这个错误:
File "interface.py", line 7, in <module>
from gtts import *
File "/usr/local/lib/python3.4/dist-packages/gtts/\__init__.py", line 2, in <module>
from .tts import gTTS
File "/usr/local/lib/python3.4/dist-packages/gtts/tts.py", line 4, in <module>
from requests.packages.urllib3.exceptions import InsecureRequestWarning
ImportError: cannot import name 'InsecureRequestWarning'
尝试解决我所做的问题
sudo easy_install --upgrade pip
然后我卸载并重新安装了gtts,但问题仍然存在。
非常感谢您的帮助! :(
PS:我已经安装了 python-vlc 和 mutagen 来使 gTTS 正常工作(就像我在 Windows 设备上所做的那样)
最佳答案
只需更新requests
库
pip install -U requests
关于python - 导入错误:无法导入名称 'InsecureRequestWarning' (PYTHON3 | RPI3 | gTTS),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43500250/