记录 anaconda安装jieba
最近用到 jieba ,在anaconda 怎么也安装补上,在网上找了一下,发现有几篇文章写得很好,但是为了怕自己以后再浪费时间,这里还是做个记录。
通常安装模块直接用pip install jieba,或者conda install jieba,但是有一些模块是无法使用以上两种方式安装上,这时就需要首先寻找模块,再安装。
1、anaconda search -t conda jieba寻找模块,这时会出现该模块的很多版本的信息如下。
~ » anaconda search -t conda jieba unicorn@unicorndeMacBook-Pro Using Anaconda API: https://api.anaconda.org Packages: Name | Version | Package Types | Platforms | Builds ------------------------- | ------ | --------------- | --------------- | ---------- auto/jieba | 0.32 | conda | linux-64, linux-32 | py27_0 : http://github.com/fxsjy conda-forge/jieba | 0.39 | conda | linux-64, win-32, osx-64, noarch, win-64 | py_1, py36_0, py35_0, py27_0 : Chinese Words Segementation Utilities conda-forge/jieba3k | 0.35.1 | conda | linux-64, win-32, osx-64, win-64, noarch | py36_1001, py37_1001, py36_1, py_0, py35_1001, py35_1 : Chinese Words Segementation Utilities creditx/jieba | 0.38 | conda | linux-64 | py35_0, py27_0 hargup/jieba | | conda | linux-64 | py27_0 : Chinese Words Segementation Utilities iilab/jieba | 0.36.2 | conda | linux-64, osx-64 | py34_0 : Chinese Words Segementation Utilities iilab/jieba3k | 0.35.1 | conda | linux-64, osx-64 | py34_0 : Chinese Words Segementation Utilities jiangxiluning/jieba | 0.36.2 | conda | linux-64, osx-64, win-64 | py27_0 : Chinese Words Segementation Utilities moustik/jieba | 0.38 | conda | linux-64 | py27_0 r/r-jiebard | 0.1 | conda | noarch | r36h6115d3f_0 : jiebaR is a package for Chinese text segmentation, keyword extraction and speech tagging. This package provides the data files required by jiebaR. r_test/r-jiebard | 0.1 | conda | noarch | r36h6115d3f_0 : jiebaR is a package for Chinese text segmentation, keyword extraction and speech tagging. This package provides the data files required by jiebaR. syllabs_admin/jieba | 0.39 | conda | linux-64 | py27ha286e51_0 Found 12 packages Run 'anaconda show <USER/PACKAGE>' to get installation details
2、找到合适的版本,根据版本的信息,输入anaconda show conda-forge/jieba3k,这时会出现该版本的信息如下,再执行最后一行的信息即可安装这时会出现。
~ » anaconda show conda-forge/jieba3k unicorn@unicorndeMacBook-Pro Using Anaconda API: https://api.anaconda.org Name: jieba3k Summary: Chinese Words Segementation Utilities Access: public Package Types: conda Versions: + 0.35.1 To install this package with conda run: conda install --channel https://conda.anaconda.org/conda-forge jieba3k
3、执行最后一行的信息即可安装输入conda install --channel https://conda.anaconda.org/conda-forge jieba3k 进行安装
~ » conda install --channel https://conda.anaconda.org/conda-forge jieba3k unicorn@unicorndeMacBook-Pro Collecting package metadata (current_repodata.json): done Solving environment: \ The environment is inconsistent, please check the package plan carefully The following packages are causing the inconsistency: - defaults/osx-64::anaconda==2019.07=py37_0 - defaults/osx-64::numba==0.44.1=py37h6440ff4_0 done ## Package Plan ## environment location: /Users/username/anaconda3 added / updated specs: - jieba3k The following packages will be downloaded: package | build ---------------------------|----------------- _anaconda_depends-2019.03 | py37_0 6 KB anaconda-custom | py37_1 3 KB ca-certificates-2019.9.11 | hecc5488_0 143 KB conda-forge certifi-2019.9.11 | py37_0 147 KB conda-forge conda-4.7.12 | py37_0 3.0 MB conda-forge jieba3k-0.35.1 | py37_1001 6.2 MB conda-forge openssl-1.1.1c | h01d97ff_0 1.9 MB conda-forge tbb-2018.0.5 | h2d50403_0 150 KB conda-forge ------------------------------------------------------------ Total: 11.5 MB The following NEW packages will be INSTALLED: _anaconda_depends pkgs/main/osx-64::_anaconda_depends-2019.03-py37_0 jieba3k conda-forge/osx-64::jieba3k-0.35.1-py37_1001 tbb conda-forge/osx-64::tbb-2018.0.5-h2d50403_0 The following packages will be UPDATED: ca-certificates pkgs/main::ca-certificates-2019.5.15-0 --> conda-forge::ca-certificates-2019.9.11-hecc5488_0 certifi pkgs/main::certifi-2019.6.16-py37_0 --> conda-forge::certifi-2019.9.11-py37_0 The following packages will be SUPERSEDED by a higher-priority channel: conda pkgs/main --> conda-forge openssl pkgs/main::openssl-1.1.1c-h1de35cc_1 --> conda-forge::openssl-1.1.1c-h01d97ff_0 The following packages will be DOWNGRADED: anaconda 2019.07-py37_0 --> custom-py37_1 Proceed ([y]/n)? y
Downloading and Extracting Packages
_anaconda_depends-20 | 6 KB | ################################################################################################################################################################# | 100%
certifi-2019.9.11 | 147 KB | ################################################################################################################################################################# | 100%
openssl-1.1.1c | 1.9 MB | ################################################################################################################################################################# | 100%
tbb-2018.0.5 | 150 KB | ################################################################################################################################################################# | 100%
ca-certificates-2019 | 143 KB | ################################################################################################################################################################# | 100%
jieba3k-0.35.1 | 6.2 MB | ################################################################################################################################################################# | 100%
conda-4.7.12 | 3.0 MB | ################################################################################################################################################################# | 100%
anaconda-custom | 3 KB | ################################################################################################################################################################# | 100%
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
这样就安装好了,在anaconda 当前环境中就能看到jieba,打开jupyter notebook import jieba ,可以成功执行。
如果上面方法不行,那只能手动安装了,安装方法如下:
1、从官网下载jieba压缩包
https://pypi.org/project/jieba/#files 下载包
2、将压缩包解压到anaconda的pkgs目录。
3、打开anaconda prompt,切换目录至比如我的D:/anaconda/pkgs/jieba-0.39
然后执行python setup.py install即可。
4、再次打开jupyter notebook 测试import jieba,正常
pycharm中 import jieba ,正常。
参考文档:
https://blog.csdn.net/a857553315/article/details/81410142