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
Miniconda安装 虚拟环境创建 与包管理的更多相关文章
- python3.4学习笔记(八) Python第三方库安装与使用,包管理工具解惑
python3.4学习笔记(八) Python第三方库安装与使用,包管理工具解惑 许多人在安装Python第三方库的时候, 经常会为一个问题困扰:到底应该下载什么格式的文件?当我们点开下载页时, 一般 ...
- Flask实战-留言板-安装虚拟环境、使用包组织代码
Flask实战 留言板 创建项目目录messageboard,从GreyLi的代码中把Pipfile和Pipfile.lock文件拷贝过来,这两个文件中定义了虚拟环境中需要安装的包的信息和位置,进入m ...
- 程序包管理rpm、yum与简单编译安装程序
Linux程序包管理 Linux中软件的安装主要有两种形式:一种是直接下载源代码包自行编译后安装,另一种直接获取rpm软件包进行安装. 程序的组成部分: 二进制程序:程序的主体文件,比如我们运行一个l ...
- 【程序包管理】篇章3:CentOS平台下软件包安装方法总结
1.软件包安装前的学习:程序包管理的基础知识 2.程序包安装的方法介绍: rpm文件的二进制包安装:Linux程序包管理之rpm安装总结 yum安装:Linux程序包管理之yum源安装 链接:本地yu ...
- 安装一些包管理的记录 win10
我大php的composer 国内镜像包http://pkg.phpcomposer.com/ 还是全局的爽些: omposer config -g repo.packagist composer ...
- Linux程序包管理rpm与yum
Linux程序包管理 Linux中软件的安装主要有两种形式:一种是直接下载源代码包自行编译后安装,另一种直接获取rpm软件包进行安装. 程序的组成部分: 二进制程序:程序的主体文件,比如我们运行一个l ...
- JavaScript包管理器综述
JavaScript包管理器综述 作者:chszs,未经博主同意不得转载.经许可的转载需注明作者和博客主页:http://blog.csdn.net/chszs 对于JavaScript来说.包管理器 ...
- vue — 安装并创建vue项目
1.先从node.js官网(https://nodejs.org/en/download/) 下载并安装node,然后通过在命令行输入node -v命令,查看node的版本,要是出现相应的版本号就证明 ...
- Linux-程序包管理
Linux上的软件安装有2种形式:源码.二进制文件,源码需要在编译环境下编译安装,二进制可以直接安装. 1.程序包管理器 rpm 程序包管理器能够将目标二进制格式(也就是从源码编译好的二进制文件,包括 ...
随机推荐
- 第02组Alpha冲刺(4/4)
队名:十一个憨批 组长博客 作业博客 组长黄智 过去两天完成的任务:了解整个游戏的流程 GitHub签入记录 接下来的计划:继续完成游戏 还剩下哪些任务:完成游戏 燃尽图 遇到的困难:没有美术比较好的 ...
- 10-排序5 PAT Judge (25 分)
The ranklist of PAT is generated from the status list, which shows the scores of the submissions. Th ...
- python对图片批量命名
深度学习中经常会有批量对图片进行重命名,从网上看到的资料整理一下,方便以后查看. import os class BatchRename(): ''' 批量重命名文件夹中的图片文件 ''' def _ ...
- nginx负载均衡原理
负载均衡在服务端开发中算是一个比较重要的特性.因为Nginx除了作为常规的Web服务器外,还会被大规模的用于反向代理前端,因为Nginx的异步框架可以处理很大的并发请求,把这些并发请求hold住之后就 ...
- mapreduce 函数入门 二
m apreduce三大组件:Combiner\Sort\Partitioner 默认组件:排序,分区(不设置,系统有默认值) 一.mapreduce中的Combiner 1.什么是combiner ...
- VisualStudio更改项目文件夹名称
新建了一个空的解决方案(SolutionTest.sln),在文件夹Api中新建了一个webapi项目,物理位置为解决方案根目录下的叫Api文件夹里, 现在想把文件夹名由Api改为MyApi,需要做以 ...
- C语言有关文件编辑的函数
fopen()函数 函数作用 用来打开一个文件 头文件 #include <stdio.h> 用法 FILE *fopen(char *filename, *type); TYPES &q ...
- 一个萝卜一个坑#M坑—Polynomial、Polyder
Polynomial 作用:对输入值执行多项式系数计算,输入输出都可为实数标量或向量. 库:Simulink / Math Operations Polyval 作用:多项式计算,即求多项式在某一点的 ...
- Tomcat安装及配置(Linux系统)
环境说明:Linux环境,CentOS 7版本. 第一步:下载tomcat 版本,下载地址:https://tomcat.apache.org/index.html 我用的是zip结尾的包 解压命令: ...
- easyui-datagrid 加载数据 的两种方法
var start_date_entered=$('#start_date_entered').val(); //创建时间 var stop_date_entered=$('#stop_date_en ...