1、anaconda换源
conda config --add channels https:
//mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --
set
show_channel_urls yes
2、创建一个名为python36的环境,指定Python版本是3.6
conda create --name python36 python=3.6
3、激活某个环境
activate python36 # for Windows
source activate python36 # for Linux & Mac
deactivate python36 # for Windows
source deactivate python36 # for Linux & Mac
4、 删除一个已有的环境
conda remove --name python36 --all
5、conda包管理
5.1安装xxxx
conda install xxxx
5.2查看当前环境下已安装的包
conda list
5.3查看某个指定环境的已安装包
conda list -n python36
5.4查找package信息
conda search numpy
5.5安装package
conda install -n python34 numpy # 如果不用-n指定环境名称,则被安装在当前活跃环境 也可以通过-c指定通过某个channel安装
6、Conda 更新
6.1 更新package
conda update -n python34 numpy
6.2 删除package
conda remove -n python34 numpy
6.3 更新conda,保持conda最新
conda update -n base conda
6.4 更新anaconda
conda update anaconda
6.5 更新python
conda update python
7、pip使用
# pip安装包
$ pip install SomePackage
[...]
Successfully installed SomePackage
# pip查看已安装的包
$ pip show --files SomePackage
Name: SomePackage
Version: 1.0
Location: /my/env/lib/pythonx.x/site-packages
Files:
../somepackage/__init__.py
[...]
# pip检查哪些包需要更新
$ pip list --outdated
SomePackage (Current: 1.0 Latest: 2.0)
# pip升级包
$ pip install --upgrade SomePackage
[...]
Found existing installation: SomePackage 1.0
Uninstalling SomePackage:
Successfully uninstalled SomePackage
Running setup.py install for SomePackage
Successfully installed SomePackage
# pip卸载
$ pip uninstall SomePackage
Uninstalling SomePackage:
/my/env/lib/pythonx.x/site-packages/somepackage
Proceed (y/n)? y
Successfully uninstalled SomePackage