Why I receive ImportError: cannot import name 'fore' from 'colorama'?
Why I receive ImportError: cannot import name 'fore' from 'colorama'?
我可以执行 colorama 模块,但收到错误消息。
我的代码
from colorama import init
init()
from colorama import fore, back, style
what = input( print.red + "What kind of operation? (+, -, /, *): ")
a = float( input("Input first number?: ") )
b = float( input("Input second number: ") )
if what == "+":
c = a + b
print("Final: " + str(c))
if what == "-":
c = a - b
print("Final: " + str(c))
if what == "*":
c = a * b
print("Final: " + str(c))
if what == "/":
c = a / b
print("Final: " + str(c))
else:
print("Please check operation")
和错误
Traceback (most recent call last):
File "D:/projects.py/calclulator.py", line 3, in <module>
from colorama import fore, back, style
ImportError: cannot import name 'fore' from 'colorama' (D:\projects.py\venv\lib\site-packages\colorama\__init__.py)
我使用 PyCharm 作为 IDK
当我 运行 它没有 colorama 我没有任何错误
请帮忙!
您应该导入的内容是 Fore
、Back
和 Style
。注意那些大写字母!
我可以执行 colorama 模块,但收到错误消息。 我的代码
from colorama import init
init()
from colorama import fore, back, style
what = input( print.red + "What kind of operation? (+, -, /, *): ")
a = float( input("Input first number?: ") )
b = float( input("Input second number: ") )
if what == "+":
c = a + b
print("Final: " + str(c))
if what == "-":
c = a - b
print("Final: " + str(c))
if what == "*":
c = a * b
print("Final: " + str(c))
if what == "/":
c = a / b
print("Final: " + str(c))
else:
print("Please check operation")
和错误
Traceback (most recent call last):
File "D:/projects.py/calclulator.py", line 3, in <module>
from colorama import fore, back, style
ImportError: cannot import name 'fore' from 'colorama' (D:\projects.py\venv\lib\site-packages\colorama\__init__.py)
我使用 PyCharm 作为 IDK 当我 运行 它没有 colorama 我没有任何错误 请帮忙!
您应该导入的内容是 Fore
、Back
和 Style
。注意那些大写字母!