由于工作平台原因,需要在内网下安装深度学习框架,不联网的话,需要提前下载好第三方库的安装包,再离线安装。这里以Anaconda和Tensorflow为例,看过几个博客,坑不少,所以这里写点心得。这里以python3.8,conda4.10,tensorflow-2.6为例,先下载好Anaconda3-2021.05-Windows-x86_64与tensorflow-2.6.0-cp38-cp38-win_amd64。 一、下载情况 1.Anaconda的下载:https://www.anaconda.com/download/ 2.Tensorflow的下载,可以去清华大学开源软件镜像站,好多博主给的网站都是之前的,不可用,新地址为https://pypi.tuna.tsinghua.edu.cn/simple/ 3.Tensorflow的支撑包需要以下这些: Requirement already satisfied: keras~=2.6 Requirement already satisfied: keras-preprocessing~=1.1.2 Requirement already satisfied: gast==0.4.0 Requirement already satisfied: wrapt~=1.12.1 Requirement already satisfied: h5py~=3.1.0 Requirement already satisfied: termcolor~=1.1.0 Requirement already satisfied: grpcio<2.0,>=1.37.0 Requirement already satisfied: astunparse~=1.6.3 Requirement already satisfied: tensorboard~=2.6 Requirement already satisfied: wheel~=0.35 Requirement already satisfied: opt-einsum~=3.3.0 Requirement already satisfied: absl-py~=0.10 Requirement already satisfied: google-pasta~=0.2 Requirement already satisfied: typing-extensions~=3.7.4 Requirement already satisfied: numpy~=1.19.2 Requirement already satisfied: protobuf>=3.9.2 Requirement already satisfied: flatbuffers~=1.12.0 Requirement already satisfied: six~=1.15.0 Requirement already satisfied: tensorflow-estimator~=2.6 Requirement already satisfied: clang~=5.0 Requirement already satisfied: setuptools>=41.0.0 Requirement already satisfied: requests<3,>=2.21.0 Requirement already satisfied: tensorboard-data-server<0.7.0,>=0.6.0 Requirement already satisfied: tensorboard-plugin-wit>=1.6.0 Requirement already satisfied: werkzeug>=0.11.15 Requirement already satisfied: google-auth<2,>=1.6.3 Requirement already satisfied: google-auth-oauthlib<0.5,>=0.4.1 Requirement already satisfied: markdown>=2.6.8 Requirement already satisfied: rsa<5,>=3.1.4 Requirement already satisfied: pyasn1-modules>=0.2.1 Requirement already satisfied: cachetools<5.0,>=2.0.0 Requirement already satisfied: requests-oauthlib>=0.7.0 Requirement already satisfied: pyasn1<0.5.0,>=0.4.6 Requirement already satisfied: urllib3<1.27,>=1.21.1 Requirement already satisfied: certifi>=2017.4.17 Requirement already satisfied: idna<3,>=2.5 Requirement already satisfied: chardet<5,>=3.0.2 Requirement already satisfied: oauthlib>=3.0.0 二、安装过程 1.安装Anaconda 2.进入Anaconda安装路径,到\Lib\site-packages目录下,创建文件夹tensorflow 3.在创建的tensorflow文件夹中,解压上文下载的支撑包.rar,将支撑包文件夹中的所有文件都放到tensorflow文件夹中 4.将tensorflow-2.6.0-cp38-cp38-win_amd64.whl文件放到tensorflow文件夹中 5.解压protoc-3.17.3-win64.zip,将bin中的protoc.exe复制到C:\windows\system32中 6.直接解压protobuf-python-3.17.3.zip,得到protobuf-3.17.3.文件夹,将第5步中的protoc.exe文件也复制到protobuf-3.17.3\src文件夹中 7.在cmd命令中更改路径,进入到\Lib\site-packages\tensorflow\protobuf-3.17.3\python路径中,执行python setup.py install; 8.切换安装路径到\Lib\site-packages\tensorflow,接下来先安装tensorflow的各个支撑包,顺序不对,按提示进行安装 whl文件直接就利用pip install 文件名;rar压缩文件形式的安装,与安装protobuf一致,先解压,然后切换路径,再执行python setup.py install。 三、本教程各支撑包如图版本在这里插入图片描述 ,其他版本的自行从网站下载:https://pypi.org/search/ 记得要安装和python对应各个版本,否则会出错 如numpy-1.19.2-cp38-cp38-win_amd64.whl 表示numpy的版本是python3.8,64位操作系统的。
|