ubuntu18.04 安装anaconda
1,安装
1.1 anaconda,版本:python3.7
Windows(win7,win10) ,Anaconda3-2020.02-Windows-x86_64.exe
ubuntu (Linux) x64,Anaconda3-2020.02-Linux-x86_64.sh
Mac OS,Anaconda3-2020.02-MacOSX-x86_64.pkg
1.2 minianaconda, 地址
2,配置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
Linux系统设置,conda环境设置,国内conda源
编辑.condarc文件
Linux操作系统
vim ~/.condarc
channels:
- defaults
show_channel_urls: true
channel_alias: https://mirrors.tuna.tsinghua.edu.cn/anaconda
default_channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/pro
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
custom_channels:
conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
2.1 conda环境配置指令
conda env list # conda列表
conda clean -i # 更新conda源
source activate myenv # 激活环境
source deactivate # 退出虚拟环境
conda create --name myenv python=3.7 # conda 创建虚拟环境
conda remove --name myenv --all # conda 删除虚拟环境
conda env export > environment.yaml # conda 环境保存
conda env create -f environment.yaml # conda 环境加载
2.2 pip环境,阿里源
pip install pip -U
pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/
pip freeze > requirements.txt # 生成所需要的包,保存在requirements.txt
pip install -r requirements.txt # 安装requirements.txt所需要的包
pip download -d demo librosa # 指定python虚拟环境,将librosa包及依赖下载到demo目录
3,安装深度学习包
3.1 ubuntu 18.04
conda update -n base -c defaults conda # conda更新
conda install pip pycparser readline setuptools sqlite tk wheel xz zlib jupyter cython tqdm
conda install libvpx mkl mkl_fft mkl_random ncurses ninja numpy numpy-base openssl lxml bs4
conda install intel-openmp libedit libffi libgfortran-ng libopus libpng libstdcxx-ng libgcc-ng
conda install blas bzip2 ca-certificates certifi cffi ffmpeg freetype tensorboard
conda install cycler decorator joblib llvmlite matplotlib unidecode pytest pandas
conda install nltk numba pyparsing python-dateutil scikit-learn scikit-image scipy six kiwisolver
conda install cudatoolkit=10.2 cudnn
conda install pytorch=1.9.0 torchaudio torchvision cudatoolkit=10.2 -c pytorch
conda install tensorflow-gpu=2.1.0 keras # cuda=11.0 -> tf-gpu=2.4.0
pip install tensorflow-gpu==1.14.0 keras==2.2.5
conda install -c defaults caffe-gpu # caffe-gpu
pip install audioread inflect librosa resampy future xlwt objgraph
pip install pycocotools dataclasses # 计算MAP
pip install ray # 自动调参工具
pip install wxauto # 微信自动化框架
# 图像
# pip install torch==1.12.0 torchvision==0.13.0 torchaudio==0.12.0
# pip install torchserve torch-model-archiver torch-workflow-archiver
# pip install focal-loss-torch # 分类优化损失函数
# pip install xlrd==1.2.0 python-docx # office解析 pandas.read_excel
# pip install pygobject gst pycairo # import gi,gst, apt-get install libgirepository1.0-dev
pip install opencv-python ffmpeg-python
pip install --user opencv-contrib-python
pip install python-poppler # pdf 转图片
pip install cryptography pyOpenSSL certifi # 爬虫组件
pip install mmcv-full mmdet mmocr mmsegmentation mmcv # mmlab开发
pip install PyOpenGL PyOpenGL_accelerate # opengl
pip install future onnx_caffe2 pytorch2caffe netron
pip install pytesseract PyHamcrest captcha imutils
pip install loguru # from loguru import logger , 打印日志
pip install pipreqs # 安装包统一
pip install pcl-py vtk==9.0.1 mayavi==4.7.3 # pcl点云 vtk
pip install insightface # face 2d/3d 分析工具
pip install open3d # 3D库
pip install pyvista # vtk
pip install kafka-python # 消息队列
pip install pytorchvideo
pip install scikit-opt # 启发式算法,包括差分进化、遗传、粒子群、模拟退火、蚁群、鱼群、免疫优化
conda install -c conda-forge onnx mahotas uwsgi
pip install cupy-cuda102 # cuda-python
# deepmind jax,haiku
pip install --upgrade jax jaxlib==0.1.57+cuda102 -f https://storage.googleapis.com/jax-releases/jax_releases.html
pip install git+https://github.com/deepmind/dm-haiku
3.2 win10
conda install pip pycparser setuptools sqlite tk wheel xz zlib jupyter cython tqdm
conda install pandas numpy matplotlib
conda install mkl mkl_fft mkl_random python-dateutil scikit-learn scikit-image tensorboard
conda install cudatoolkit=10.2 cudnn
conda install pytorch=1.7.0 torchvision cudatoolkit=10.2 -c pytorch
conda install pytorch torchvision torchaudio cpuonly -c pytorch
pip install audioread inflect librosa resampy
pip install opencv-python
pip install --user opencv-contrib-python
pip install qstock tushare efinance akshare mplfinance
4 其他软件包
# 网络
conda install requests
conda install tornado flask aiohttp
pip install fastapi uvicorn # 网站发布
pip install web.py==0.40.dev0
pip install sqlalchemy # 数据库连接
# 中间件技术
pip install pika # rabbitmq
pip install redis
pip install redis-py-cluster
# 自然语言处理
conda install gensim
conda install seaborn
conda install plotly
pip install jieba
conda install whoosh
pip install torchtext
conda install nltk # sudo apt-get install libsqlite3-dev
pip install refo sparqlwrapper
pip install stanfordcorenlp # Stanford大学开发NLP包
pip install foolnltk
pip install rdflib
pip install pyDatalog
pip install owlready
pip install ast
pip install difflib
pip install python-Levenshtein
pip install query
pip install pytorch_transformers
pip install pytorch-pretrained-bert # bert
pip install albert_pytorch # albert
# 游戏
pip install gym
pip install pygame
# 音频\语音
pip install baidu-aip # 百度的TTS
pip install gTTS # Google的TTS,目前支持中文
pip install pydub # 下载ffmpeg,解压,并添加到系统环境变量
pip install python_speech_features # MFCC函数
pip install playsound
pip install simpleaudio
pip install pyttsx3 # offline的TTS
pip install --ignore-installed llvmlite
pip install librosa
pip install unidecode
pip install inflect
pip install theano
pip install bandmat
pip install h5py==2.8.0rc1 # 不加版本,会有FutureWarning
# python GUI
pip install wxPython
pip install kivy # 火
# Mechine Learning
pip install pydotplus graphviz # 决策树可视化
pip install xgboost # xgboost包
pip install hmmlearn # 隐马尔科夫
# 爬虫
pip install scrapy==1.5.0
# enhance
pip install cupy-cuda100 # cuda version 10.0
pip install pycuda>=2019.1.1
pip install kornia
pip install torch2trt
pip install ray # tune
# 其他
pip install pywifi # 破解wifi密码
pip install pybarcode pystrich # 制作条形码,一维码
pip install qrcode # 制作二维码
pip install lupa # lua语言
pip install mplfinance # K线
pip install test-generator==0.1.1 defusedxml==0.5.0 # openvino
pip install onnx-simplifier
pip install pdf2image fitz PyMuPDF # pdf -> png
5,lmdb
python -m pip install pyreadline
pip install wtforms
pip install flask-socketio
pip install msgpack
pip install -I Flask
pip install flask-wtf
pip install lmdb
6,flask
pip install flask
pip install alembic amqp billiard celery certifi chardet Flask Flask-Migrate
pip install Flask-Script Flask-Session Flask-SQLAlchemy Flask-WTF Jinja2 kombu Mako
7,pytorch C++环境搭建
地址
8,python文件服务器
python -m http.server 25600 # ip地址:25600 访问
9,控制台
Python 3.6.13 |Anaconda, Inc.| (default, Feb 23 2021, 21:15:04)
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> torch.__version__
'1.7.0'
>>> torch.version.cuda
'10.2'
>>> torch.backends.cudnn.version()
7605
>>> torch.cuda.get_device_name(0)
'TITAN Xp'