问题标签 [termcolor]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
2 回答
30 浏览

python - 如何使用termcolor在python中制作闪烁的文本?

每当我尝试使用 termcolor 制作闪烁的文本时,使用以下代码:

它将文本打印为红色,但不会闪烁。我需要使用一些功能来打开闪烁/类似的东西吗?

我使用使用 python 3.8.2 的replit.com 。我也尝试过 Visual Studio,但它仍然不闪烁。

0 投票
1 回答
138 浏览

python - 使用 pip 安装 tensorflow 时出错,没有名为“termcolor”的模块

我正在尝试使用 pip install tensorflow 安装 tensorflow。我可以安装其他软件包,但 tensorflow 无法正常工作。这是我得到的错误:

C:\Users\sebas>python -m pip install tensorflow

Collecting tensorflow
Using cached tensorflow-2.8.0-cp37-cp37m-win_amd64.whl (437.9 MB)
Collecting h5py>=2.9.0
Using cached h5py-3.6.0-cp37-cp37m-win_amd64.whl (2.8 MB)
Collecting tensorboard<2.9,>=2.8
Using cached tensorboard-2.8.0-py3-none-any.whl (5.8 MB)
Collecting termcolor>=1.1.0
Using cached termcolor-1.1.0.tar.gz (3.9 kB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [6 lines of output]
Traceback (most recent call last):
File "<string", line 36, in <module>
File "pip-setuptools-caller>", line 34, in <module>
File "C:\Users\sebas\AppData\Local\Temp\pip-install-vmfvacm3 \termcolor_be9b831904ce413daecad52b36f017aa\setup.py", line 35, in <module>
from termcolor import VERSION
ModuleNotFoundError: No module named 'termcolor'
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.\

0 投票
1 回答
12 浏览

python - Termcolor 返回奇怪的字符串

我正在尝试构建自己的 Wordle 版本,但我被困在这里。这部分代码的意思是,当它与秘密单词的位置和字母匹配时,将相应的字符着色为绿色,当它与字母匹配时,将其着色为黄色,而不是位置。未包含在密语中的字符不着色。

在这个例子中,我希望 "woiky" 以绿色 "w" 打印(因为 woiky 和 ​​widow 都以 "w" 开头)、黄色 "i" 和黄色 "o"(因为 "widow" 包含两者“i”和“o”,但不在这些位置),而是打印:[33m[[0m33m[33m[[0m[33m[[0m0m33m[33m[[0m33m[33m[[0m[33m[[0m0m[33m[[0m33m[33m[[0m[33m[[0m0m0m33m[33m[[0m33m [33m[[0m[33m[[0m0m33m[33m[[0m33m[33m[[0m[33m[[0m0m[33m[[0m33m[33m[[0m[33m[[0m0m0m0m[33m[[0m33m[33m[[0m [33m[[0m0m33m[33m[[0m33m[33m[[0m[33m[[0m0m[33m[[0m33m[33m[[0m[33m[[0m0m0m32mw[33m[[0m33m[33m[[0m[33m[[0m0m33m [33m[[0m33m[33m[[0m[33m[[0m0m[33m[[0m33m[33m[[0m[33m[[0m0m0m33m[33m[[0m33m[33m[[0m[33m[[0m0m33m[33m[[0m33m [33m[[0m[33m[[0m0m[33m[[0m33m[33m[[0m[33m[[0m0m0m0m[33m[[0m33m[33m[[0m[33m[[0m0m33m[33m[[0m33m[33m[[0m [33m[[0m0m[33m[[0m33m[33m[[0m[33m[[0m0m0m0moiky

所有的“[”字符都是黄色的。