python pip/anaconda使用笔记

Switch to Chinese conda Source, config file is in ~/.condarc

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

 

Switch to Chinese pip Source, it's contents here:

  • linux config file is in ~/.pip/pip.conf

  • windows config file is in %HOMEPATH%\pip\pip.ini, 

[global]
index-url = http://pypi.douban.com/simple
[install]
trusted-host=pypi.douban.com

 

Update Anaconda

conda update conda -y
conda update anaconda -y
conda update python -y
conda update --all -y

 

创建环境:conda create --name ws-gpu

删除环境:conda env remove -n ws-gpu

安装单个库:conda install scipy

清理conda缓存:conda clean --all

 

创建requirements文件,以便安装。

pip freeze > requirements_pip.txt
conda list --export > requirements_conda.txt

 

Install the conda packages

conda install --file=requirements_conda.txt

Install the pip packages

 pip install -r requirements_pip.txt

 

shell脚本

#!/bin/bash

source ~/.bashrc.with_anaconda3

conda activate tf

conda install --file=requirements_conda.txt -y
pip install -r requirements_pip.txt

 

posted @ 2018-10-27 21:23  xbit  阅读(5370)  评论(0编辑  收藏  举报