python导入time包出错_导入sutime模块时出现以下导入错误-这是什么意思?

I'm getting this error:

ImportError: cannot import name 'SUTime' from partially initialized module 'sutime' (most likely due to a circular import)

when importing the sutime module as:

from sutime import SUTime

as suggested in the sutime GitHub example: https://github.com/FraBle/python-sutime

Context: sutime is a Python library for parsing date/time from a natural language input, developed by the amazing team over at Stanford CoreNLP.

Note: I've already run the pre-req installs as well:

>> pip install setuptools_scm jpype1 # install pre-reqs

>> pip install sutime

>> # use package pom.xml to install all Java dependencies via Maven into ./jars

>> mvn dependency:copy-dependencies -DoutputDirectory=./jars

解决方案

It's not true that a circular import is the most likely cause of your error. A failed, incomplete, or in some way strange installation is more likely. Try this:

pip uninstall sutime

pip uninstall jpype1

pip uninstall setuptools_scm

pip3 install setuptools_scm jpype1 # note: pip3

pip3 install sutime

Then, in the python-sutime directory, enter this command:

./test.sh

It should output lots of log lines, and the last line but one should be similar to this:

======================== 5 passed, 2 warnings in 13.06s ========================

In the same directory you can enter and run the Python script from the Example section of the README. It should output many log lines before the reported output. There may be a way to avoid that, but anyway it happens only once, when the script starts.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值