我了解到time.clock()
自Python 3.3起已被弃用。
但是,当我尝试导入pyqtgraph模块时发生错误:
import pyqtgraph
这是文件中的唯一一行,这是错误:
File "D:\2020Backup\2020Backup\code\Python\PyQt\graphs\first.py", line 1, in <module>
import pyqtgraph
File "C:\Users\mpnlo\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyqtgraph\__init__.py", line 204, in <module>
from .graphicsItems.VTickGroup import *
File "C:\Users\mpnlo\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyqtgraph\graphicsItems\VTickGroup.py", line 7, in <module>
from .. import functions as fn
File "C:\Users\mpnlo\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyqtgraph\functions.py", line 17, in <module>
from . import debug
File "C:\Users\mpnlo\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyqtgraph\debug.py", line 11, in <module>
from . import ptime
File "C:\Users\mpnlo\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyqtgraph\ptime.py", line 24, in <module>
cstart = systime.clock() ### Required to start the clock in windows
AttributeError: module 'time' has no attribute 'clock'
我想知道是否有人知道此问题的解决方法,也许是我更新模块中错误信息的一种方法,我正在使用最新版本的pyqtgraph。
答案 0 :(得分:3)
使用pip3 install --upgrade git+http://github.com/pyqtgraph/pyqtgraph.git
答案 1 :(得分:0)
因此,一种变通方法是使用集成到pyqt5中的matplotlib模块,如果发生这种情况,则此页面概述了如何执行此操作:
https://pythonspot.com/pyqt5-matplotlib/
我希望这会有所帮助!