一文教你如何使用miniconda
安装python
之前安装python包,导致了python里面的包不兼容,用管理工具卸载也下载不掉,重新安装也安装不上,没有办法只能卸掉python重装。
安装Anaconda
Anaconda指的是一个开源的Python发行版本,其包含了conda、Python等180多个科学包及其依赖项。conda也是一个非常好用的管理工具,只不过1500多个包自己用不了多少,我就选只Minicoda,是Anaconda的精简版本,只含有python和conda管理包。
我选择了Miniconda3-4.4.10-Windows-x86_64 版本,这个版本用的是python36,这个版本之后就是python37
添加环境变量
把完整的安装目录中补全,然后把下面几个文件夹添加到环境变量
D:\Miniconda3
D:\Miniconda3\Scripts
D:\Miniconda3\Library\bin
配置conda
升级conda
conda update 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/cloud/conda-forge
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
# 中国科技大学源
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/main/
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/conda-forge/
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/msys2/
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/bioconda/
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/menpo/
# 阿里云的服务器
http://mirrors.aliyun.com/pypi/simple/
# 豆瓣网站是用python做的呀 豆瓣的python的源
conda config --add channels http://pypi.douban.com/simple/
# 设置搜索时显示通道地址
conda config --set show_channel_urls yes
# 当安装包时,总会被询问是否`Proceed ([y]/n)?` ,默认为False,设置为`always_yes: True`将不会再做提醒
conda config --set always_yes True
虚拟环境创建
命令
usage: conda create [-h] [--shortcuts] [--no-shortcuts] [-y] [--dry-run] [-f]
[--file FILE] [--no-deps] [--only-deps] [-m] [-C]
[--use-local] [--offline] [--no-pin] [-c CHANNEL]
[--override-channels] [-n ENVIRONMENT | -p PATH] [-q]
[--copy] [-k] [--update-dependencies]
[--no-update-dependencies] [--channel-priority]
[--no-channel-priority] [--clobber] [--show-channel-urls]
[--no-show-channel-urls] [--download-only] [--json]
[--debug] [--verbose] [--clone ENV]
[--no-default-packages]
[package_spec [package_spec ...]]
Create a new conda environment from a list of specified packages. To use the created environment, use 'source activate envname' look in that directory first. This command requires either the -n NAME or -p PREFIX option.
Options:
positional arguments:
package_spec Packages to install or update in the conda
environment.
optional arguments:
-h, --help Show this help message and exit.
--shortcuts Install start menu shortcuts
--no-shortcuts Don't install start menu shortcuts
-y, --yes Do not ask for confirmation.
--dry-run Only display what would have been done.
-f, --force Force install (even when package already installed).
--file FILE Read package versions from the given file. Repeated
file specifications can be passed (e.g. --file=file1
--file=file2).
--no-deps Do not install, update, remove, or change
dependencies. This WILL lead to broken environments
and inconsistent behavior. Use at your own risk.
--only-deps Only install dependencies.
-m, --mkdir Create the environment directory if necessary.
-C, --use-index-cache
Use cache of channel index files, even if it has
expired.
--use-local Use locally built packages.
--offline Offline mode, don't connect to the Internet.
--no-pin Ignore pinned file.
-c CHANNEL, --channel # 换源 国内用清华或者是豆瓣的
default channel_alias is http://conda.anaconda.org/.
--override-channels Do not search default or .condarc channels. Requires
--channel.
-n ENVIRONMENT, --name ENVIRONMENT # 虚拟环境的名字
-p PATH, --prefix PATH
Full path to environment prefix.
-q, --quiet Do not display progress bar. # 静默安装
--copy Install all packages using copies instead of hard- or
soft-linking.
-k, --insecure Allow conda to perform "insecure" SSL connections and
transfers. Equivalent to setting 'ssl_verify' to
'false'.
--update-dependencies, --update-deps
Update dependencies. Overrides the value given by
`conda config --show update_deps`.
--no-update-dependencies, --no-update-deps
Don't update dependencies. Overrides the value given
by `conda config --show update_deps`.
--channel-priority, --channel-pri, --chan-pri
Channel priority takes precedence over package
version. Overrides the value given by `conda config
--show channel_priority`.
--no-channel-priority, --no-channel-pri, --no-chan-pri
Package version takes precedence over channel
priority. Overrides the value given by `conda config
--show channel_priority`.
--clobber Allow clobbering of overlapping file paths within
packages, and suppress related warnings.
--show-channel-urls Show channel urls. Overrides the value given by `conda
config --show show_channel_urls`.
--no-show-channel-urls
Don't show channel urls. Overrides the value given by
`conda config --show show_channel_urls`.
--download-only Solve an environment and ensure package caches are
populated, but exit prior to unlinking and linking
packages into the prefix.
--json Report all output as json. Suitable for using conda
programmatically.
--debug Show debug output.
--verbose, -v Use once for info, twice for debug, three times for
trace.
--clone ENV Path to (or name of) existing local environment.
--no-default-packages
Ignore create_default_packages in the .condarc file.
虚拟环境
查看虚拟环境
conda info --envs/e
创建
# 创建一个名叫py2,使用python2.7解释器的虚拟环境 -n是虚拟环境名字,python = 2.7是指定特定版本
conda create -n py2 python=2.7
# 激活Py2虚拟环境
activate py2
#退出
deactivate
quit
包管理
conda和pip区别
conda作为包管理工具和pip类似,但是还有区别:
某些包不能通过conda安装,只能通过pip安装
anaconda python conda都被conda视为package,和普通安装包管理方式相同
普通包管理
# 查看当前激活环境中的已安装包,如果希望查询指定环境中已安装包,则在command命令后加上-n 环境名,其他命令类似
conda list (-n python34)
# 查找package信息
conda search (-n python34) numpy
# 查看某安装包是否已安装
conda list | grep 包名(支持正则)
# 安装package,如果不用-n指定环境名称,则被安装在当前活跃环境,也可以通过-c指定通过某个channel安装
conda install (-n python34) numpy
# 更新package
conda update (-n python34) numpy
# 删除package
conda remove (-n python34) numpy
# 新创建的环境只会包含较少的必须项如pip、python,若希望新环境和默认环境那样安装完整anaconda集合包
conda install anaconda
特殊包管理
我下载是是minoconda 所以只用更新conda就可以了
# 更新conda,保持conda最新
conda update conda
# 更新anaconda集合包
conda update anaconda
# 更新python,假设当前环境是python 3.4, conda会将python升级为3.4.x系列的当前最新版本
conda update python
# 更新anaconda-navigator
conda update anaconda-navigator
pip命令
Usage:
pip <command> [options]
Commands:
install Install packages.
download Download packages.
uninstall Uninstall packages.
freeze Output installed packages in requirements format.
list List installed packages.
show Show information about installed packages.
check Verify installed packages have compatible dependencies.
config Manage local and global configuration.
search Search PyPI for packages.
wheel Build wheels from your requirements.
hash Compute hashes of package archives.
completion A helper command used for command completion.
help Show help for commands.
General Options:
-h, --help Show help.
--isolated Run pip in an isolated mode, ignoring
environment variables and user configuration.
-v, --verbose Give more output. Option is additive, and can be
used up to 3 times.
-V, --version Show version and exit.
-q, --quiet Give less output. Option is additive, and can be
used up to 3 times (corresponding to WARNING,
ERROR, and CRITICAL logging levels).
--log <path> Path to a verbose appending log.
--proxy <proxy> Specify a proxy in the form
[user:passwd@]proxy.server:port.
--retries <retries> Maximum number of retries each connection should
attempt (default 5 times).
--timeout <sec> Set the socket timeout (default 15 seconds).
--exists-action <action> Default action when a path already exists:
(s)witch, (i)gnore, (w)ipe, (b)ackup, (a)bort).
--trusted-host <hostname> Mark this host as trusted, even though it does
not have valid or any HTTPS.
--cert <path> Path to alternate CA bundle.
--client-cert <path> Path to SSL client certificate, a single file
containing the private key and the certificate
in PEM format.
--cache-dir <dir> Store the cache data in <dir>.
--no-cache-dir Disable the cache.
--disable-pip-version-check
Don't periodically check PyPI to determine
whether a new version of pip is available for
download. Implied with --no-index.
--no-color Suppress colored output
链接:https://www.cnblogs.com/ruhai/p/10847220.html
一文教你如何使用miniconda的更多相关文章
- ubuntu安装miniconda
系统:ubuntu15.04 64位 wget -c http://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh chm ...
- 图文教您轻松学会用PS设计制作名片
图文教您轻松学会用PS设计制作名片 http://jingyan.baidu.com/article/49711c614e7370fa441b7ca3.html
- Intellij IDEA 2017 详细图文教程之概述
天天编码 , 版权所有丨本文标题:Intellij IDEA 2017 详细图文教程之概述 转载请保留页面地址:http://www.tiantianbianma.com/intellij-idea- ...
- Ubuntu 16.04 LTS 安装 miniconda
Ubuntu 16.04 LTS 安装 miniconda 下载 miniocnda 的 bash 文件下载链接 https://conda.io/miniconda.html ,我选择的是 64-b ...
- Miniconda 虚拟环境安装及应用
首先要下载Miniconda安装包 下载地址 链接:https://pan.baidu.com/s/1rj-9exKBSHnCCxqq7JQSxA 提取码:ab53 下一步 打开下载好的M ...
- linux windows安装python的最佳方式,miniconda
1.在linux安装python文章很多,但是步骤很多,没搞好还会把yum命令弄坏,要修复.这件事就发生在我身上,准确说不是我造成的,是总监自己安装python造成yum损坏的,然后需要运维去百度修改 ...
- 如何安装miniconda(python虚拟环境)
anaconda是用于科学计算的python发行版本(可用于python虚拟环境的管理),miniconda是简化版的anaconda 1.下载安装miniconda 下载miniconda 因为An ...
- 关于miniconda的安装,配置以及包批量安装和使用
由于时间很晚了.就不写废话了. conda官方文档地址:http://conda.pydata.org/docs/ 一切其实都可以从miniconda的文档找到,这里只纪录自己操作的时候遇到的值得一说 ...
- Miniconda安装scrapy教程
一.背景说明 前两天想重新研究下Scrapy,当时的环境是PyCharm社区版+Python 3.7.使用pip安装一直报错 “distutils.errors.DistutilsPlatformEr ...
随机推荐
- vue动画效果出现重叠,并且出现滚动条
背景 使用 vue 结合 animated css 第三方动画样式,简单地给页面组件加上切换时的 fade 淡入/淡出动画效果 当调试效果时发现,展示效果出现了问题,并且出现滚动条 原因 退场动画还没 ...
- 不使用xftp上传/下载文件到linux
yum install lrzsz # 安装软件 window端上传到linux端: 1. window端先压缩需上传的文件 2. linux端运行命令rz 3. 在弹出的窗口选择压缩好的文件, ...
- CSP2019&&AFO
day-1 attack回来了,颓废,吃蛋糕. day-0 和attack继续车上颓废. 报道,志愿者胖乎乎的,学校很新. day-1 T1写完写T2,两小时T310分 出来发现,T2好像有个地方没路 ...
- Redis删除特定前缀key的优雅实现
还在用keys命令模糊匹配删除数据吗?这就是一颗随时爆炸的炸弹! Redis中没有批量删除特定前缀key的指令,但我们往往需要根据前缀来删除,那么究竟该怎么做呢?可能你一通搜索后会得到下边的答案 re ...
- windows 排查javaWeb程序占用CPU过高问题(可追踪到问题代码所在行)
1.情景展示 java虚拟机占用这么高的CPU,肯定不正常! 2.原因分析 第一个是tomcat,正在运行java项目: 第二个是eclipse,因为eclipse的运行依赖于java. 现在的问 ...
- 结合Spring实现策略模式
最近系统需要对不同维度的数据进行差异化计算,也就会使用不同算法.为了以后更加容易扩展,结合Spring框架及策略模式对实现架构做了系统设计. 1. 定义策略接口(Strategy): import c ...
- RICOH C4502彩色打印机取消双面打印功能
参考下面步骤:
- 书籍推荐-An introduction to Data Science
为什么要读这本书? 该书是由我们老师推荐的,通过学习此数,可以了解R语言的使用,也可以知道基本的数据分析方法. 看到Creating a Data Set in R -- 24页面
- torch_02_多项式回归
""" torch.float64对应torch.DoubleTensor torch.float32对应torch.FloatTensor 将真实函数的数据点能够拟合成 ...
- 到底如何选择PHP框架?Yii、ThinkPHP、laravel、CI.
如果你是为了工作和就业,你应该选择框架以工作为目标,看公司里面未来招聘中用的最多的是什么框架.很简单的判断方式 很多朋友都不知道如何去选择框架,选择框架的时候就会很纠结.到底该学什么框架,选择什么框架 ...