Python Environment Setup in Linux
1. 下载anaconda
Anaconda installer for linxu: https://www.anaconda.com/distribution/#linux
wget https://repo.anaconda.com/archive/Anaconda3-2020.02-Linux-x86_64.sh
国内镜像:
https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/
2. 安装
bash Anaconda3-2020.02-Linux-x86_64.sh
3. 添加路径
echo 'export PATH="~/anaconda3/bin:$PATH"' >> ~/.bashrc source .bashrc
4. 测试
conda --version
python --version
5. 升级(可选)
conda upgrade --all
6. 设置环境
conda create -n env_name python=3.7 anaconda pip conda activate env_name
conda环境相关操作
查询
conda env list
退出
conda deactivate
删除环境
conda env remove --name env_name
7. 安装package
Image packages
pip install torch torchvision -f https://download.pytorch.org/whl/torch_stable.html --no-dependencies pip install scikit-learn==0.21.3 pip install six pip install scipy==1.1.0 pip install web.py==0.40.dev1 pip install opencv-python pip install Django conda install pillow=6.2.1 conda install cudnn=7.6.5 conda install cudatoolkit=10.0
OCR packages
pip install pytesseract pip install pillow brew install tesseract #install tesseract on Mac
apt-get install tesseract-ocr-LANG #install tesseract on Linux
To install languages individually:
cd /path/to/tessdata_best/folder wget https://github.com/tesseract-ocr/tessdata/raw/master/eng.traineddata #English data export TESSDATA_PREFIX=/path/to/tessdata_best/folder
Ref:
https://stackoverflow.com/questions/14800730/tesseract-running-error
https://guides.library.illinois.edu/c.php?g=347520&p=4121425
NLP packages
pip install altgraph==0.16.1 pdfminer.six pip install beautifulsoup4==4.7.1 pip install bs4==0.0.1 xlrd==1.2.0 pip install future==0.17.1 mammoth==1.4.10 pip install joblib==0.11 macholib==1.11 numpy==1.17.3 pip install pefile==2019.4.18 PyInstaller==3.4 regex==2019.4.14 pandas==0.24.2 chardet==3.0.4 textile==3.0.4 pip install scikit-learn==0.21.3 scipy==1.3.0 setuptools==40.6.2 soupsieve==1.9.1 pkuseg==0.0.22 gensim==3.7.1
8. 安装IDE
Pycharm: http://macappstore.org/pycharm/