python - 无法从“termcolor”导入名称“colored”
问题描述
我正在尝试使用 termcolor 教程在 python3 中使用 termcolor,但我无法从 termcolor 导入颜色
from termcolor import colored
text = colored("Hello world", "green")
print(text)
它给了我
E:\>python termcolor.py
Traceback (most recent call last):
File "termcolor.py", line 1, in <module>
from termcolor import colored
File "E:\termcolor.py", line 1, in <module>
from termcolor import colored
ImportError: cannot import name 'colored' from 'termcolor' (E:\termcolor.py)
解决方案
推荐阅读
- python - 来自 CSV 的 Python 列表切片
- html - 给定的代码应该使 div 标题浮动到右上角,但这样做时会移动几个像素。为什么它会自己移动?
- c++ - 如何从 findcontour Opencv C++ 放大每个矩形(边界框)
- mysql - 在 asp.net 核心中按 id 过滤 GET 查询的问题。获得正确数量的行,但都完全相同
- html - HTML 不打印烧瓶返回的全名
- c# - 在没有模型绑定的情况下发布到 .NET Core Web API 控制器
- javascript - LocalStorage 不保留值
- c++ - 获得向量/数组数据大小参考的好语法?
- javascript - 调用返回数字为 fn(10) 或 fn * 10 的函数
- python - 2003: Can't connect to MySQL server on '127.0.0.1:10652' (10061 No connection could be made because the target machine拒绝了)