如何修复 Python No module named 'colors'

问题

运行 Python 应用程序时,你看到类似以下的错误消息:

error_trace.txt
File "/app/test.py", line 9, in <module>
    from colors import red
ModuleNotFoundError: No module named 'colors'

解决方案

安装提供 colors 模块的 ansicolors 模块:

install_ansicolors.sh
pip install ansicolors

Check out similar posts by category: Python