搭建NLP相关的python环境

## conda环境:
https://www.cnblogs.com/wxiaoli/p/8830989.html

## 镜像安装lib:python -m pip install -i https://pypi.tuna.tsinghua.edu.cn/simple [libname]

必备lib:

numpy  scipy  matplotlib  sklearn  pandas  spacy  gensim

按需lib:

tensorflow(2.1.0)  transformers

## 配置jupyter:
https://www.cnblogs.com/wxiaoli/p/10648251.html


安装过程中可能遇到一些问题及排错:(注:以下问题发生环境:ubuntu+miniconda)

1. 添加conda镜像通道: conda config --add channels 'https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/' 
删除conda镜像通道: conda config --remove channels 'https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/' 
另,中科大镜像:https://mirrors.ustc.edu.cn/anaconda/pkgs/free/

2. 激活conda环境后,用pip3 install 安装jieba,并且提示“Successfully installed jieba-0.42.1”后,报错:No module named 'jieba'
原因:ubuntu系统中直接使用pip命令时会默认使用系统环境中的python工具(偏偏ubuntu系统中内置了python2和python3,因此在安装时没有报错)
解决:在conda中的python环境中安装包时用 python -m pip install,或者使用conda install
另,使用pip其他功能时也应带 python -m 前缀

3. conda install 一直报错:miniconda Segmentation fault (core dumped)
解决:用conda clean -a删除缓存,重新安装

4. 在环境中安装jupyter内核时报错:
>>  python -m ipykernel install --name tf
[Errno 13] Permission denied: '/usr/local/share/jupyter'
解决: python -m ipykernel install --user --name tf

posted @ 2020-06-11 16:55  wxiaoli  阅读(445)  评论(0编辑  收藏  举报