attributeerror模块'time'没有属性'clock'(pyqt5)

问题描述 投票:0回答:2

我了解自Python 3.3起不推荐使用time.clock()。但是,当我尝试导入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。

python pyqt pyqt5 pyqtgraph
2个回答
2
投票

使用pip3 install --upgrade git+http://github.com/pyqtgraph/pyqtgraph.git安装最新的版本


0
投票

因此,如果您遇到这种情况,可以使用整合到pyqt5中的matplotlib模块的解决方法,此页面概述了如何执行此操作:

https://pythonspot.com/pyqt5-matplotlib/

我希望这会有所帮助!

© www.soinside.com 2019 - 2024. All rights reserved.