Anaconda 利用conda安装第3方包

1.包安装

(1)安装指定的一个包

conda install package_name
注意:package_name为包的名称 

例如要安装numpy,操作示例:

利用win+R键,进入cmd窗口

conda install numpy

(2)同时安装多个包,可以输入

conda install pandas numpy

(3)如果想要指定包的版本,可以输入

conda install numpy=1.14

2.包移除

 conda remove package_name

示例:移除numpy

conda remove numpy

3.更新包

conda update package_name

示例:更新numpy

conda update numpy

4.查看所有已安装的包

conda list

5.解决conda install 下载速度慢

#例如, 添加清华anaconda镜像:
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --set show_channel_urls yes

6.安装pandas、scikit-learn、scipy、matplotlib 的部分截图参考

(1)安装pandas

(2)安装sklearn包

conda install scikit-learn

(3)安装scipy

conda install Scipy

(4)安装matplotlib 

conda install matplotlib 

7.conda安装jieba部分截图

这时,输入如下代码:

anaconda show conda-forge/jieba

conda install --channel https://conda.anaconda.org/conda-forge jieba

 8.安装pytorch

利用conda安装,则安装前输入以下代码

### 设置清华源镜像
 conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
 conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
 conda config --set show_channel_urls yes
### 设置pytorch镜像
 conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
 conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/peterjc123/

打开pytorch 官网:https://pytorch.org/

cpu版本pytorch安装命令如下:

conda install pytorch torchvision cpuonly

复制PyTorch官网命令,并将 -c pytorch删除。
-c pytorch是强制从PyTorch官网下载包,配置的清华源就会失效。

 参考文献:https://www.jianshu.com/p/07abfe5f82e1

9.安装Pytorchtext

conda install  torchtext

若出现conda找不到包的情况,首先尝试使用手机热点,切换网络。

 10 安装spacy

conda config --add channels conda-forge
conda install spacy

 安装完spacy后,使用时需要en_core_web_md(spacy的模型)

利用常规的命令

python -m spacy download en

会报连接错误443

最后使用pip安装

下载链接:https://github.com/explosion/spacy-models ,选择与spacy版本匹配的spacy-model 

https://github.com/explosion/spacy-models/tags?after=pt_core_news_sm-2.2.0

最后,利用pip安装

pip install E:\toolsoftware\en_core_web_md-2.2.0.tar.gz

注意:E:\toolsoftware\en_core_web_md-2.2.0.tar.gz 为包的路径

C:\Users\lucky>pip install D:\BaiduNetdiskDownload\en_core_web_md-2.2.0.tar.gz
Processing d:\baidunetdiskdownload\en_core_web_md-2.2.0.tar.gz
Requirement already satisfied: spacy>=2.2.0 in d:\softwaretools\anaconda\lib\site-packages (from en-core-web-md==2.2.0) (2.2.1)
Requirement already satisfied: plac<1.0.0,>=0.9.6 in d:\softwaretools\anaconda\lib\site-packages (from spacy>=2.2.0->en-core-web-md==2.2.0) (0.9.6)
Requirement already satisfied: wasabi<1.1.0,>=0.2.0 in d:\softwaretools\anaconda\lib\site-packages (from spacy>=2.2.0->en-core-web-md==2.2.0) (0.7.0)
Requirement already satisfied: cymem<2.1.0,>=2.0.2 in d:\softwaretools\anaconda\lib\site-packages (from spacy>=2.2.0->en-core-web-md==2.2.0) (2.0.3)
Requirement already satisfied: blis<0.5.0,>=0.4.0 in d:\softwaretools\anaconda\lib\site-packages (from spacy>=2.2.0->en-core-web-md==2.2.0) (0.4.1)
Requirement already satisfied: numpy>=1.15.0 in d:\softwaretools\anaconda\lib\site-packages (from spacy>=2.2.0->en-core-web-md==2.2.0) (1.16.4)
Requirement already satisfied: requests<3.0.0,>=2.13.0 in d:\softwaretools\anaconda\lib\site-packages (from spacy>=2.2.0->en-core-web-md==2.2.0) (2.22.0)
Requirement already satisfied: srsly<1.1.0,>=0.1.0 in d:\softwaretools\anaconda\lib\site-packages (from spacy>=2.2.0->en-core-web-md==2.2.0) (1.0.0)
Requirement already satisfied: murmurhash<1.1.0,>=0.28.0 in d:\softwaretools\anaconda\lib\site-packages (from spacy>=2.2.0->en-core-web-md==2.2.0) (1.0.0)
Requirement already satisfied: thinc<7.2.0,>=7.1.1 in d:\softwaretools\anaconda\lib\site-packages (from spacy>=2.2.0->en-core-web-md==2.2.0) (7.1.1)
Requirement already satisfied: preshed<3.1.0,>=3.0.2 in d:\softwaretools\anaconda\lib\site-packages (from spacy>=2.2.0->en-core-web-md==2.2.0) (3.0.2)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in d:\softwaretools\anaconda\lib\site-packages (from requests<3.0.0,>=2.13.0->spacy>=2.2.0->en-core-web-md==2.2.0) (3.0.4)
Requirement already satisfied: certifi>=2017.4.17 in d:\softwaretools\anaconda\lib\site-packages (from requests<3.0.0,>=2.13.0->spacy>=2.2.0->en-core-web-md==2.2.0) (2019.6.16)
Requirement already satisfied: idna<2.9,>=2.5 in d:\softwaretools\anaconda\lib\site-packages (from requests<3.0.0,>=2.13.0->spacy>=2.2.0->en-core-web-md==2.2.0) (2.8)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in d:\softwaretools\anaconda\lib\site-packages (from requests<3.0.0,>=2.13.0->spacy>=2.2.0->en-core-web-md==2.2.0) (1.24.2)
Requirement already satisfied: tqdm<5.0.0,>=4.10.0 in d:\softwaretools\anaconda\lib\site-packages (from thinc<7.2.0,>=7.1.1->spacy>=2.2.0->en-core-web-md==2.2.0) (4.32.1)
Building wheels for collected packages: en-core-web-md
  Building wheel for en-core-web-md (setup.py) ... done
  Stored in directory: C:\Users\lucky\AppData\Local\pip\Cache\wheels\ce\6c\e7\16ad3df9e0dda1c9497218aaf976c1d07c00ae7ff4c7595cc6
Successfully built en-core-web-md
Installing collected packages: en-core-web-md
Successfully installed en-core-web-md-2.2.0

从cmd复制出来的代码可知:en-core-web-md-2.2.0安装成功。

pip安装的包路径在:

d:\softwaretools\anaconda\lib\site-packages

参考文献:https://www.zhihu.com/question/56095738

11.安装emoji

conda install -c conda-forge emoji

 12.安装wordcloud

conda install -c conda-forge wordcloud

 13.安装gensim

conda install -c conda-forge gensim

 若无法安装:

则采用pip安装.

pip install gensim -i https://pypi.doubanio.com/simple

cmd日志:

Microsoft Windows [版本 10.0.17134.915]
(c) 2018 Microsoft Corporation。保留所有权利。

C:\Users\Administrator>pip install gensim -i https://pypi.doubanio.com/simple
Looking in indexes: https://pypi.doubanio.com/simple
Collecting gensim
  Downloading https://pypi.doubanio.com/packages/0b/66/04faeedb98bfa5f241d0399d0102456886179cabac0355475f23a2978847/gensim-3.8.3-cp37-cp37m-win_amd64.whl (24.2MB)
     |████████████████████████████████| 24.2MB 167kB/s
Requirement already satisfied: numpy>=1.11.3 in c:\softapplication\anaconda3\lib\site-packages (from gensim) (1.16.4)
Requirement already satisfied: six>=1.5.0 in c:\softapplication\anaconda3\lib\site-packages (from gensim) (1.12.0)
Collecting smart-open>=1.8.1 (from gensim)
  Downloading https://pypi.doubanio.com/packages/0b/8e/464b06f5efd26f2dc16ce7bd1662c2f31cadf9104fdbcbf5994674cc3a51/smart_open-2.1.0.tar.gz (116kB)
     |████████████████████████████████| 122kB 930kB/s
Requirement already satisfied: scipy>=0.18.1 in c:\softapplication\anaconda3\lib\site-packages (from gensim) (1.2.1)
Collecting Cython==0.29.14 (from gensim)
  Downloading https://pypi.doubanio.com/packages/1f/be/b14be5c3ad1ff73096b518be1538282f053ec34faaca60a8753d975d7e93/Cython-0.29.14-cp37-cp37m-win_amd64.whl (1.7MB)
     |████████████████████████████████| 1.7MB 3.3MB/s
Requirement already satisfied: requests in c:\softapplication\anaconda3\lib\site-packages (from smart-open>=1.8.1->gensim) (2.22.0)
Requirement already satisfied: boto in c:\softapplication\anaconda3\lib\site-packages (from smart-open>=1.8.1->gensim) (2.49.0)
Collecting boto3 (from smart-open>=1.8.1->gensim)
  Downloading https://pypi.doubanio.com/packages/f2/48/5e45a055eb74405e8cd3e9464517007e28ee7b574377f26cee7b624e2f1f/boto3-1.14.18-py2.py3-none-any.whl (128kB)
     |████████████████████████████████| 133kB 3.3MB/s
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in c:\softapplication\anaconda3\lib\site-packages (from requests->smart-open>=1.8.1->gensim) (1.24.2)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in c:\softapplication\anaconda3\lib\site-packages (from requests->smart-open>=1.8.1->gensim) (3.0.4)
Requirement already satisfied: certifi>=2017.4.17 in c:\softapplication\anaconda3\lib\site-packages (from requests->smart-open>=1.8.1->gensim) (2019.6.16)
Requirement already satisfied: idna<2.9,>=2.5 in c:\softapplication\anaconda3\lib\site-packages (from requests->smart-open>=1.8.1->gensim) (2.8)
Collecting s3transfer<0.4.0,>=0.3.0 (from boto3->smart-open>=1.8.1->gensim)
  Downloading https://pypi.doubanio.com/packages/69/79/e6afb3d8b0b4e96cefbdc690f741d7dd24547ff1f94240c997a26fa908d3/s3transfer-0.3.3-py2.py3-none-any.whl (69kB)
     |████████████████████████████████| 71kB 1.5MB/s
Collecting botocore<1.18.0,>=1.17.18 (from boto3->smart-open>=1.8.1->gensim)
  Downloading https://pypi.doubanio.com/packages/b8/c5/e0347f2c24e2bf0a8215755f0c372c127db037bb3179d3a6b44bd3eed06c/botocore-1.17.18-py2.py3-none-any.whl (6.3MB)
     |████████████████████████████████| 6.3MB 595kB/s
Collecting jmespath<1.0.0,>=0.7.1 (from boto3->smart-open>=1.8.1->gensim)
  Downloading https://pypi.doubanio.com/packages/07/cb/5f001272b6faeb23c1c9e0acc04d48eaaf5c862c17709d20e3469c6e0139/jmespath-0.10.0-py2.py3-none-any.whl
Requirement already satisfied: docutils<0.16,>=0.10 in c:\softapplication\anaconda3\lib\site-packages (from botocore<1.18.0,>=1.17.18->boto3->smart-open>=1.8.1->gensim) (0.14)
Requirement already satisfied: python-dateutil<3.0.0,>=2.1 in c:\softapplication\anaconda3\lib\site-packages (from botocore<1.18.0,>=1.17.18->boto3->smart-open>=1.8.1->gensim) (2.8.0)
Building wheels for collected packages: smart-open
  Building wheel for smart-open (setup.py) ... done
  Stored in directory: C:\Users\Administrator\AppData\Local\pip\Cache\wheels\c0\6a\99\a94d38a27388c3ac815f97ae30a48e6db85c57dd8f92b285e7
Successfully built smart-open
Installing collected packages: jmespath, botocore, s3transfer, boto3, smart-open, Cython, gensim
  Found existing installation: Cython 0.29.12
    Uninstalling Cython-0.29.12:
      Successfully uninstalled Cython-0.29.12
Successfully installed Cython-0.29.14 boto3-1.14.18 botocore-1.17.18 gensim-3.8.3 jmespath-0.10.0 s3transfer-0.3.3 smart-open-2.1.0

C:\Users\Administrator>

 

posted @ 2020-04-10 13:55  雨后观山色  阅读(4001)  评论(0编辑  收藏  举报