我正在使用SenseHat开发树莓派。使用(base) 192:~ lsluyser$ sudo anaconda-navigator
Password:
Traceback (most recent call last):
File "/anaconda3/lib/python3.7/site-packages/qtpy/__init__.py", line 199, in <module>
from PySide import __version__ as PYSIDE_VERSION # analysis:ignore
ModuleNotFoundError: No module named 'PySide'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/anaconda3/bin/anaconda-navigator", line 7, in <module>
from anaconda_navigator.app.main import main
File "/anaconda3/lib/python3.7/site-packages/anaconda_navigator/app/main.py", line 22, in <module>
from anaconda_navigator.utils.conda import is_conda_available
File "/anaconda3/lib/python3.7/site-packages/anaconda_navigator/utils/__init__.py", line 15, in <module>
from qtpy.QtGui import QIcon
File "/anaconda3/lib/python3.7/site-packages/qtpy/__init__.py", line 205, in <module>
raise PythonQtError('No Qt bindings could be found')
qtpy.PythonQtError: No Qt bindings could be found
会以较长的浮点数吐出温度,而我一直在尝试更改温度,但我只是遇到类型错误
get_temperature
这是我所熟悉的错误代码
from sense_hat import SenseHat
sense = SenseHat ()
import time
red = [225, 0, 0]
green = [0, 225, 0]
blue = [0, 0, 225]
while 1 == 1:
time.sleep(10)
rawTemp = sense.get_temperature()
temp = int(rawTemp * 1.8 + 22)
if temp <= 70:
tempColor = blue
elif temp >= 74:
tempColor = red
else:
tempColor = green
sense.show_message(temp, text_colour = tempColor)
答案 0 :(得分:1)
好吧,它要求str
sense.show_message(temp, text_colour = tempColor)
并且您在temp中将此函数设置为int,请尝试以下操作:
sense.show_message(str(temp), text_colour = tempColor)