Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

module 'time' has no attribute 'clock' #100

Open
BrandNewJimZhang opened this issue Feb 29, 2020 · 4 comments
Open

module 'time' has no attribute 'clock' #100

BrandNewJimZhang opened this issue Feb 29, 2020 · 4 comments

Comments

@BrandNewJimZhang
Copy link

在Python 3.8中,time.clock()已经被移除了。但是切割句子时仍然使用了这个。

@dovecho
Copy link

dovecho commented Mar 9, 2020

Simply change start = time.clock() to start = time.perf_counter() in the file: thulac/character/CBTaggingDecoder.py, the program will run well

@HannibalXZX
Copy link

我也有这个问题,但是在2.7版本可以运行。你可以尝试改成2.7,也可以把相应的函数替换为3.8版本的

use time.perf_counter or time.process_time instead time.clock()

改完以后,我这边3.8版本,运行成功。

@fncokg
Copy link

fncokg commented Aug 21, 2021

Simply change start = time.clock() to start = time.perf_counter() in the file: thulac/character/CBTaggingDecoder.py, the program will run well

Modifying the source code isn't a good practice, since that means you cannot migrate your code to a another device. Try this instead(before the official fix this):

import time
if not hasattr(time, 'clock'):
    setattr(time,'clock',time.perf_counter)

Then your code will run well no matter on a Python<3.8 or a Python>=3.8.

@YunfangHou
Copy link

Simply change start = time.clock() to start = time.perf_counter() in the file: thulac/character/CBTaggingDecoder.py, the program will run well

Modifying the source code isn't a good practice, since that means you cannot migrate your code to a another device. Try this instead(before the official fix this):

import time
if not hasattr(time, 'clock'):
    setattr(time,'clock',time.perf_counter)

Then your code will run well no matter on a Python<3.8 or a Python>=3.8.

It works. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants