怎么在Anaconda 2.7下import jieba

发布于 09-05 05:00 字数 3187 浏览 24 评论 0

我现在在Anaconda 2.7里想要import jieba,但是一直不成功,给我这个提示:

import jieba
Traceback (most recent call last):

File "<ipython-input-211-533d403cdb1f>", line 1, in <module>

import jieba

ImportError: No module named jieba

我已经在terminal里输了 pip install jieba
给我的显示是:
Users-MacBook-Air-5:~ user$ pip install jieba
Requirement already satisfied: jieba in /anaconda/lib/python2.7/site-packages/jieba-0.38-py2.7.egg

不知道这样算不是已经安装好了?但是就是没有办法import

后来看到一个帖子,我试了这个方法:
Users-MacBook-Air-5:~ user$ conda install jieba
Fetching package metadata .........

PackageNotFoundError: Package missing in current osx-64 channels:

  • jieba

Users-MacBook-Air-5:~ user$ anaconda search -t conda jieba
Using Anaconda API: https://api.anaconda.org
Run 'anaconda show <USER/PACKAGE>' to get more details:
Packages:

 Name                      |  Version | Package Types   | Platforms      
 ------------------------- |   ------ | --------------- | ---------------
 auto/jieba                |     0.32 | conda           | linux-64, linux-32
                                      : http://github.com/fxsjy
 conda-forge/jieba         |     0.38 | conda           | linux-64, win-32, win-64, osx-64
 creditx/jieba             |     0.38 | conda           | linux-64       
 hargup/jieba              |          | conda           | linux-64       
                                      : Chinese Words Segementation Utilities
 iilab/jieba               |   0.36.2 | conda           | linux-64, osx-64
                                      : Chinese Words Segementation Utilities
 iilab/jieba3k             |   0.35.1 | conda           | linux-64, osx-64
                                      : Chinese Words Segementation Utilities
 jiangxiluning/jieba       |   0.36.2 | conda           | linux-64, osx-64, win-64
                                      : Chinese Words Segementation Utilities
 moustik/jieba             |     0.38 | conda           | linux-64       

Found 8 packages
Users-MacBook-Air-5:~ user$ conda install -c https://conda.anaconda.org/iilab jieba
Fetching package metadata ...........
Solving package specifications: .

UnsatisfiableError: The following specifications were found to be in conflict:

  • jieba -> python 3.4*

  • python 2.7*
    Use "conda info <package>" to see the dependencies for each package.

Users-MacBook-Air-5:~ user$ conda install -c https://conda.anaconda.org/iilab jieba3k
Fetching package metadata ...........
Solving package specifications: .

UnsatisfiableError: The following specifications were found to be in conflict:

  • jieba3k -> python 3.4*

  • python 2.7*
    Use "conda info <package>" to see the dependencies for each package.

那最后这个unsatisfiableErrors是什么问题呢

我是小白,求各位大神carry一下!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

余生一个溪2022-09-12 05:00:30

unsatisfiableErrors就是运行环境不对的意思,这个包需要python3.4的吧。

凡尘雨2022-09-12 05:00:30

你电脑里的有多环境python,默认pip与python不是一个环境的。导致PIP安装的东西不在默认python的库里。配置一下环境变量。

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文