官方网站
以前,在linux下面可以使用Pyenv,那windows下面就靠这个工具了。
# 下载安装
网络不好的可以去这里直接拿安装包
安装完毕后,添加环境变量,下面是我的按照目录
D:\Tools\anaconda\Scripts
打开一个CMD,查看conda --version
# conda --help
C:\Users\loki>conda --help
usage: conda-script.py [-h] [-V] command ...
conda is a tool for managing and deploying applications, environments and packages.
Options:
positional arguments:
command
clean Remove unused packages and caches.
compare Compare packages between conda environments.
config Modify configuration values in .condarc. This is modeled after the git config command. Writes to the
user .condarc file (C:\Users\loki\.condarc) by default.
create Create a new conda environment from a list of specified packages.
help Displays a list of available conda commands and their help strings.
info Display information about current conda install.
init Initialize conda for shell interaction. [Experimental]
install Installs a list of packages into a specified conda environment.
list List linked packages in a conda environment.
package Low-level conda package utility. (EXPERIMENTAL)
remove Remove a list of packages from a specified conda environment.
uninstall Alias for conda remove.
run Run an executable in a conda environment. [Experimental]
search Search for packages and display associated information. The input is a MatchSpec, a query language
for conda packages. See examples below.
update Updates conda packages to the latest compatible version.
upgrade Alias for conda update.
optional arguments:
-h, --help Show this help message and exit.
-V, --version Show the conda version number and exit.
conda commands available from other packages:
build
content-trust
convert
debug
develop
env
index
inspect
metapackage
render
repo
server
skeleton
token
verify
C:\Users\loki>conda --help |more
usage: conda-script.py [-h] [-V] command ...
conda is a tool for managing and deploying applications, environments and packages.
Options:
positional arguments:
command
clean Remove unused packages and caches.
compare Compare packages between conda environments.
config Modify configuration values in .condarc. This is modeled
after the git config command. Writes to the user .condarc
file (C:\Users\loki\.condarc) by default.
create Create a new conda environment from a list of specified
packages.
help Displays a list of available conda commands and their help
strings.
info Display information about current conda install.
init Initialize conda for shell interaction. [Experimental]
install Installs a list of packages into a specified conda
environment.
list List linked packages in a conda environment.
package Low-level conda package utility. (EXPERIMENTAL)
remove Remove a list of packages from a specified conda environment.
uninstall Alias for conda remove.
run Run an executable in a conda environment. [Experimental]
search Search for packages and display associated information. The
input is a MatchSpec, a query language for conda packages.
See examples below.
update Updates conda packages to the latest compatible version.
upgrade Alias for conda update.
optional arguments:
-h, --help Show this help message and exit.
-V, --version Show the conda version number and exit.
conda commands available from other packages:
build
content-trust
convert
debug
develop
env
index
inspect
metapackage
render
repo
server
skeleton
token
verify
View Code
# 创建一个新环境
conda create -n py34 python=3.4
Note: 遇到一个报错
解决方法:
找到 .condarc 文件路径,我的是在C:\Users\loki,修改内容为: (清华大学镜像)
channels:
- http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
ssl_verify: true
show_channel_urls: true
# 按照完毕后,查看是否已经安装成功, conda env list
# 切换环境版本 activate <刚刚取的名字>
# 如果记不清了可以conda env list 命令来查询
# 卸载环境 conda remove --name py34 --all
# 安装/卸载/更新第三方包
conda install requests Or pip install requests
conda remove requests Or pip uninstall requests
# 查看环境包信息
conda list
# 导入导出环境
conda env export -n base > d:\environment.yaml ## 导出名叫 base的环境
conda env create -f environment.yaml ## 导入
与JetBrains PyCharm 连接
在Setting => Project => Project Interpreter 里面修改 Project Interpreter , 点击齿轮标志再点击Add Local为你某个环境的python.exe解释器就行了