1、上传Anaconda3安装包
Anaconda3-2020.02-Linux-x86_64.sh
2、给执行权限
[root@hadoop102 software]# chmod 755 Anaconda3-2020.02-Linux-x86_64.sh
3、安装
[root@hadoop102 software]# sh Anaconda3-2020.02-Linux-x86_64.sh
操作流程
enter -> yes -> enter
4、添加Anaconda国内镜像
(base)[root@hadoop102 software]# conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
(base)[root@hadoop102 software]# conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
5、创建python3.6虚拟环境
(base)[root@hadoop102 software]# conda create -n mypy36 python=3.6
6、激活 python3.6
[root@hadoop102 software]# source activate
(base) [root@hadoop102 software]# source deactivate
[root@hadoop102 software]# source activate
(base) [root@hadoop102 software]# conda activate mypy36
(mypy36) [root@hadoop102 software]#
7、安装 tensorflow 1.9
(mypy36) [root@hadoop102 ~]# conda install tensorflow==1.9.0
or
(mypy36) [root@hadoop102 ~]# pip install tensorflow==1.9.0
pip install tensorflow-gpu==1.9(这是GPU的)
8、使用镜像安装tensorflow 1.9
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple/ tensorflow==1.9.0
一般来说,我们使用pip的方式都是 pip install xxx
例如安装pandas库
pip install pandas
使用镜像的安装范式为
pip install -i http://... pandas
那个http://...就是代指国内镜像地址
常用的有镜像有
官方源 https://pypi.python.org/simple
清华大学镜像 https://pypi.tuna.tsinghua.edu.cn/simple/
阿里云 http://mirrors.aliyun.com/pypi/simple/
中科大镜像 https://pypi.mirrors.ustc.edu.cn/simple/
豆瓣镜像 http://pypi.douban.com/simple/
中科大镜像2 http://pypi.mirrors.ustc.edu.cn/simple/
中国科学院 http://pypi.mirrors.opencas.cn/simple/
9、配置pip国内镜像
(mypy36) [root@hadoop102 software]# cd
(mypy36) [root@hadoop102 ~]# mkdir .pip
(mypy36) [root@hadoop102 ~]# cd .pip
(mypy36) [root@hadoop102 .pip]# touch pip.conf
(mypy36) [root@hadoop102 .pip]# vim pip.conf
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
10、pip多镜像源配置文件内容
[global]
timeout = 60
index-url = http://pypi.douban.com/simple
extra-index-url = http://mirrors.aliyun.com/pypi/simple/
https://pypi.tuna.tsinghua.edu.cn/simple/
http://pypi.mirrors.ustc.edu.cn/simple/
[install]
trusted-host=pypi.douban.com
# trusted-host 此参数是为了避免麻烦,否则使用的时候可能会提示不受信任
# trusted-host = https://pypi.tuna.tsinghua.edu.cn(这里不使用,使用上面的那个即可)
mirrors.aliyun.com
pypi.tuna.tsinghua.edu.cn
pypi.mirrors.ustc.edu.cn
[freeze]
timeout = 10
11、tensorflow 离线安装包可以保存
(mypy36) [root@centos101 software]# find / -name tensorflow
/root/anaconda3/envs/mypy36/lib/python3.6/site-packages/tensorflow
/root/anaconda3/envs/mypy36/lib/python3.6/site-packages/tensorflow/include/tensorflow
12、安装opencv-python
(mypy36) [root@hadoop102 ~]# pip install opencv-python==3.4.2.16
(mypy36) [root@hadoop102 ~]# pip install -i https://pypi.tuna.tsinghua.edu.cn/simple/ opencv-python==3.4.2.16
13、安装一下其它环境依赖
(mypy36) [root@hadoop102 ~]# pip install --upgrade pip( 或者使用 pip3 install --upgrade pip)
(mypy36) [root@hadoop102 ~]# pip install Cython
(mypy36) [root@hadoop102 ~]# pip install easydict
(mypy36) [root@hadoop102 ~]# pip install pillow
(mypy36) [root@hadoop102 ~]# pip install scipy
(mypy36) [root@hadoop102 ~]# pip install matplotlib
(mypy36) [root@hadoop102 ~]# pip install dlib-19.7.0-cp36-cp36m-win_amd64.whl
(mypy36) [root@hadoop102 ~]# pip install face_recognition-1.2.3-py2.py3-none-any.whl
(mypy36) [root@hadoop102 ~]# pip install opencv_python
(mypy36) [root@hadoop102 ~]# pip install freetype-py
(mypy36) [root@hadoop102 ~]# pip list
(mypy36) [root@hadoop102 ~]# conda install jupyter notebook
(mypy36) [root@hadoop102 ~]# conda install spyder
(mypy36) [root@hadoop102 ~]# conda install gevent
14、进入python
(mypy36) [root@centos101 ~]# python
Python 3.6.10 |Anaconda, Inc.| (default, Jan 7 2020, 21:14:29)
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
``` scala