以前安裝python包,致使了python裏面的包不兼容,用管理工具卸載也下載不掉,從新安裝也安裝不上,沒有辦法只能卸掉python重裝。python
Anaconda指的是一個開源的Python發行版本,其包含了conda、Python等180多個科學包及其依賴項。conda也是一個很是好用的管理工具,只不過1500多個包本身用不了多少,我就選只Minicoda,是Anaconda的精簡版本,只含有python和conda管理包。shell
清華大學Miniconda鏡像json
我選擇了Miniconda3-4.4.10-Windows-x86_64 版本,這個版本用的是python36,這個版本以後就是python37app
把完整的安裝目錄中補全,而後把下面幾個文件夾添加到環境變量less
D:\Miniconda3 D:\Miniconda3\Scripts D:\Miniconda3\Library\bin
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相似,可是還有區別:python2.7
某些包不能經過conda安裝,只能經過pip安裝socket
anaconda python conda都被conda視爲package,和普通安裝包管理方式相同ide
# 查看當前激活環境中的已安裝包,若是但願查詢指定環境中已安裝包,則在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
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