fxsjy / jieba

结巴中文分词
MIT License
33.39k stars 6.73k forks source link

MacOS python3.8 安装成功后import失败 #923

Closed jacktang closed 3 years ago

jacktang commented 3 years ago

安装

Looking in indexes: https://mirrors.aliyun.com/pypi/simple
Collecting jieba
  Downloading https://mirrors.aliyun.com/pypi/packages/c6/cb/18eeb235f833b726522d7ebed54f2278ce28ba9438e3135ab0278d9792a2/jieba-0.42.1.tar.gz (19.2 MB)
     |████████████████████████████████| 19.2 MB 1.6 MB/s
Building wheels for collected packages: jieba
  Building wheel for jieba (setup.py) ... done
  Created wheel for jieba: filename=jieba-0.42.1-py3-none-any.whl size=19314478 sha256=ad8dd8673a0bbf59d79001f302828bc7d8f36d7aec9734044f42f0a831bbb0fe
  Stored in directory: /Users/jack/Library/Caches/pip/wheels/44/66/13/57d80ae29d31d0ed7ee6898cb75a5c3c6da353e5e1ef5a6203
Successfully built jieba
Installing collected packages: jieba
Successfully installed jieba-0.42.1

import jieba失败

Python 3.8.5 (default, Sep  4 2020, 02:22:02)
[Clang 10.0.0 ] :: Anaconda, Inc. on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import jieba
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/jack/anaconda3/lib/python3.8/site-packages/jieba/__init__.py", line 14, in <module>
    from . import finalseg
  File "/Users/jack/anaconda3/lib/python3.8/site-packages/jieba/finalseg/__init__.py", line 6, in <module>
    from .._compat import *
  File "/Users/jack/anaconda3/lib/python3.8/site-packages/jieba/_compat.py", line 2, in <module>
    import logging
  File "/Users/jack/anaconda3/lib/python3.8/logging/__init__.py", line 26, in <module>
    import sys, os, time, io, re, traceback, warnings, weakref, collections.abc
  File "/Users/jack/anaconda3/lib/python3.8/traceback.py", line 5, in <module>
    import linecache
  File "/Users/jack/anaconda3/lib/python3.8/linecache.py", line 11, in <module>
    import tokenize
  File "/Users/jack/Code/best-job-server/src/main/w2v/tokenize.py", line 4, in <module>
    jieba.enable_paddle()# 启动paddle模式。 0.40版之后开始支持,早期版本不支持
AttributeError: partially initialized module 'jieba' has no attribute 'enable_paddle' (most likely due to a circular import)
>>> quit()

另外我装的jieba已经是0.42.1版本了,不知道为什么jieba.enable_paddle()# 启动paddle模式。 0.40版之后开始支持,早期版本不支持 也报错

jacktang commented 3 years ago

tokenize.py文件重名了。。