网站制作学习网Python→正文:ImportError: cannot import name 'clock' from 'time' (unknown location)
字体:

ImportError: cannot import name 'clock' from 'time' (unknown location)

Python 2024/1/23 19:45:42  点击:不统计

http://%77%77%77%2E%66网站制作%6F学习网%72%61%73%70%2E%63%6E

在windows 使用绿色版使用python3.8 是遇到了
 
    from passlib.utils import (
  File "E:\venv\lib\site-packages\passlib\utils\__init__.py", line 845, in <module>
    from time import clock as timer
ImportError: cannot import name 'clock' from 'time' (unknown location)
 
问题是在python3.8 以及以后都不再使用 clock 了,要更改
 
 找到这个site-packages\passlib\utils\__init__.py 文件打开
 
 将顶部的import 
 from time import clock as timer 
 更改为:
 from time import process_time as timer
 
 再次运行即可,问题解决。

forasp.cn

·上一篇:python查询输出site-package路径 >>    ·下一篇:windows绿色版python 安装扩展 >>
推荐文章
最新文章