安装未选添加到PATH选项
C盘是固态硬盘,直接安装在C盘 (访问速度比机械硬盘快)
配置环境变量C:\Users\Administrator\Anaconda3\Scripts
由于其他工具用到python,所以把python.exe的路径也添加到环境变量中C:\Users\Administrator\Anaconda3
检查配置是否生效:
C:\Users\Administrator>conda --version ---conda包管理命令
conda 4.5.12
C:\Users\Administrator>python --version
Python 3.7.1
更新包失败:
C:\Users\Administrator>conda upgrade --all
Solving environment: failed
CondaHTTPError: HTTP 000 CONNECTION FAILED for url https://repo.anaconda.com/pkgs/pro/win-64/repodata.json.bz2
Elapsed: -
初步怀疑要,尝试用国内的源:
源的自定义文件与anaconda在同一个目录下面,名字叫".condarc"
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
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/pkgs/free/
conda config --set show_channel_urls yes
另外,还有一个中科大的源:
https://mirrors.ustc.edu.cn/anaconda/pkgs/free/
以上两个国内源试了,都是不成功。暂时先放着不更新包了,先熟悉下环境。
activate命令默认是anadconda当前的base
C:\Users\Administrator>activate
(base) C:\Users\Administrator>python
Python 3.7.1 (default, Dec 10 2018, 22:54:23) [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
由于上面源的问题,创建也不成功。
conda create -n learn python=3
activate learn — learn是用anaconda3的向导他建的,即它的图形化工具。
conda env list查看所有环境
C:\Users\Administrator>conda env list
# conda environments:
#
base * C:\Users\Administrator\Anaconda3
conda list 查看当前环境安装的所有包信息
C:\Users\Administrator>conda list
packages in environment at C:\Users\Administrator\Anaconda3:
Name Version Build Channel
_ipyw_jlab_nb_ext_conf 0.1.0 py37_0
alabaster 0.7.12 py37_0
anaconda 2018.12 py37_0
anaconda-client 1.7.2 py37_0
anaconda-navigator 1.9.6 py37_0
anaconda-project 0.8.2 py37_0
asn1crypto 0.24.0 py37_0
astroid 2.1.0 py37_0
astropy 3.1 py37he774522_0
activate // 切换到base环境
activate learn // 切换到learn环境
conda create -n learn python=3 // 创建一个名为learn的环境并指定python版本为3(的最新版本)
conda env list // 列出conda管理的所有环境
conda list // 列出当前环境的所有包
conda install requests 安装requests包
conda remove requests 卸载requets包
conda remove -n learn --all // 删除learn环境及下属所有包
conda update requests 更新requests包
conda env export > environment.yaml // 导出当前环境的包信息
conda env create -f environment.yaml // 用配置文件创建新的虚拟环境
conda deactivate退出当前虚拟环境
1)升级需要在对应的虚拟环境下才能成功,因为SSL对应的包是在相应虚拟环境下,否则报错都是因为
找不到SSL相关的功能包而导致联网失败。而且这里也没有切换到国内清华/科大的源,直接用adaconda
默认的源升级一样成功,当然用国内可能速度会快点。
2)其实,安装好anaconda后,有一个anaconda prompt命令行窗口工具,用这个工具就会直接进入
默认base虚拟环境,然后在此下面操作上面升级同样不会有问题,就怕是直接在win10--运行框---cmd
,然后直接在windows的命令行下使用,如果是新手,就会遇到上面的问题。
3)另外,安装时,或安装后都不要设置anaconda的环境变量,这样直接使用windows的命令行就不
起作用,自然就会尝试用anaconda自带的命令行窗口工具。
在对应环境下操作一切正常,以及导出命令的使用:
C:\Users\Administrator>activate ---默认切换到base虚拟环境下
(base) C:\Users\Administrator>conda update -n base -c defaults conda
Solving environment: done
## Package Plan ##
environment location: C:\Users\Administrator\Anaconda3
added / updated specs:
- conda
The following packages will be downloaded:
package | build
---------------------------|-----------------
conda-4.6.7 | py37_0 1.7 MB
The following packages will be UPDATED:
Proceed ([y]/n)? y
Downloading and Extracting Packages
conda-4.6.7 | 1.7 MB | ############################################################################ | 100%
Preparing transaction: done
Verifying transaction: done
(base) C:\Users\Administrator>conda update numpy --说明numpy是最新包
Collecting package metadata: done
Solving environment: done
# All requested packages already installed.
(base) C:\Users\Administrator>conda env list ---列出当前所有虚拟环境
# conda environments:
#
base * C:\Users\Administrator\Anaconda3
learn C:\Users\Administrator\Anaconda3\envs\learn ---这个原先是用Navigator向导创建的
(base) C:\Users\Administrator>conda remove -n learn --all --删除自己创建的Learn及其所有包等
Remove all packages in environment C:\Users\Administrator\Anaconda3\envs\learn:
## Package Plan ##
environment location: C:\Users\Administrator\Anaconda3\envs\learn
The following packages will be REMOVED:
ca-certificates-2019.1.23-0
certifi-2018.11.29-py37_0
openssl-1.1.1b-he774522_0
pip-19.0.3-py37_0
python-3.7.2-h8c8aaf0_10
setuptools-40.8.0-py37_0
sqlite-3.26.0-he774522_0
vc-14.1-h0510ff6_4
vs2015_runtime-14.15.26706-h3a45250_0
wheel-0.33.1-py37_0
wincertstore-0.2-py37_0
Proceed ([y]/n)? y
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
(base) C:\Users\Administrator>
(base) C:\Users\Administrator>conda env list
# conda environments:
#
base * C:\Users\Administrator\Anaconda3
(base) C:\Users\Administrator>
C:\Users\Administrator>activate
(base) C:\Users\Administrator>conda create -n learn python=3 ---默认安装python最新版本
Collecting package metadata: done
Solving environment: done
## Package Plan ##
environment location: C:\Users\Administrator\Anaconda3\envs\learn
added / updated specs:
- python=3
The following NEW packages will be INSTALLED:
ca-certificates pkgs/main/win-64::ca-certificates-2019.1.23-0
certifi pkgs/main/win-64::certifi-2018.11.29-py37_0
openssl pkgs/main/win-64::openssl-1.1.1b-he774522_0
pip pkgs/main/win-64::pip-19.0.3-py37_0
python pkgs/main/win-64::python-3.7.2-h8c8aaf0_10 ---当前最新3.7.2
setuptools pkgs/main/win-64::setuptools-40.8.0-py37_0
sqlite pkgs/main/win-64::sqlite-3.26.0-he774522_0
vc pkgs/main/win-64::vc-14.1-h0510ff6_4
vs2015_runtime pkgs/main/win-64::vs2015_runtime-14.15.26706-h3a45250_0
wheel pkgs/main/win-64::wheel-0.33.1-py37_0
wincertstore pkgs/main/win-64::wincertstore-0.2-py37_0
Proceed ([y]/n)? n
Exiting.
(base) C:\Users\Administrator>conda create -n learn python=3.5 --- 安装Python3.5
Collecting package metadata: done
Solving environment: done
## Package Plan ##
environment location: C:\Users\Administrator\Anaconda3\envs\learn
added / updated specs:
- python=3.5
The following packages will be downloaded:
package | build
---------------------------|-----------------
certifi-2018.8.24 | py35_1 140 KB
pip-10.0.1 | py35_0 1.8 MB
python-3.5.6 | he025d50_0 18.2 MB
setuptools-40.2.0 | py35_0 597 KB
wheel-0.31.1 | py35_0 81 KB
wincertstore-0.2 | py35hfebbdb8_0 13 KB
------------------------------------------------------------
Total: 20.8 MB
The following NEW packages will be INSTALLED:
certifi pkgs/main/win-64::certifi-2018.8.24-py35_1
pip pkgs/main/win-64::pip-10.0.1-py35_0
python pkgs/main/win-64::python-3.5.6-he025d50_0
setuptools pkgs/main/win-64::setuptools-40.2.0-py35_0
vc pkgs/main/win-64::vc-14.1-h0510ff6_4
vs2015_runtime pkgs/main/win-64::vs2015_runtime-14.15.26706-h3a45250_0
wheel pkgs/main/win-64::wheel-0.31.1-py35_0
wincertstore pkgs/main/win-64::wincertstore-0.2-py35hfebbdb8_0
Proceed ([y]/n)?
Downloading and Extracting Packages
wincertstore-0.2 | 13 KB | ############################################################################ | 100%
setuptools-40.2.0 | 597 KB | ############################################################################ | 100%
pip-10.0.1 | 1.8 MB | ############################################################################ | 100%
certifi-2018.8.24 | 140 KB | ############################################################################ | 100%
wheel-0.31.1 | 81 KB | ############################################################################ | 100%
python-3.5.6 | 18.2 MB | ############################################################################ | 100%
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
#
To activate this environment, use
#
$ conda activate learn
#
To deactivate an active environment, use
#
$ conda deactivate
(base) C:\Users\Administrator>conda env list
conda environments:
#
base * C:\Users\Administrator\Anaconda3
learn C:\Users\Administrator\Anaconda3\envs\learn
(base) C:\Users\Administrator>activate learn
(learn) C:\Users\Administrator>conda env export > environment.gary ---导出虚拟环境Learn,
可以用这种方式把相关联的包导出
(learn) C:\Users\Administrator>dir
2019/03/01 13:02 43 .condarc
2019/03/01 13:04 349 environment.gary
2018/11/29 14:47 Favorites
C:\Users\Dell\Anaconda3\python.exe "C:\Program Files\JetBrains\PyCharm Community Edition 2018.3.2\helpers\pydev\pydevconsole.py" --mode=client --port=64760
Traceback (most recent call last):
File "C:\Program Files\JetBrains\PyCharm Community Edition 2018.3.2\helpers\pydev\pydevconsole.py", line 5, in
from pydev_comm.rpc import make_rpc_client, start_rpc_server, start_rpc_server_and_make_client
File "C:\Program Files\JetBrains\PyCharm Community Edition 2018.3.2\helpers\pydev_pydev_comm\rpc.py", line 4, in
.......
>>>>
添加环境变量就可以解决了,比如安装路径为D:\anaconda3, 在环境变量中添加
D:\anaconda3;D:\anaconda3\Scripts;D:\anaconda3\Library\bin.
Anaconda3-2018.12-Windows-x86_64.exe
pycharm-professional-2018.3.5.exe