问题及解决方案
(1)找不到问文件/路径
#利用anaconda prompt
(base) C:\Users\XwwwJ>pip install tensorflow_cpu-2.6.0-cp38-cp38-win_amd64.whl
ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory:···
用cd ..
命令将路径切换到Anaconda路径下pip
就可以
(base) D:\anaconda\Scripts>pip ···
(2)超时问题!试过的命令:
#指定对应的python或tensorflow版本安装,最后都显示超时
pip install tensorflow_cpu-2.6.0-cp38-cp38-win_amd64.whl
pip install tensorflow-cpu==2.3.0 -i https://pypi.douban.com/simple/
没有指定版本,直接用镜像源安装下来的版本好像是最新版本tensorflow-2.8.0
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple tensorflow
Successfully installed absl-py-1.0.0 astunparse-1.6.3 cachetools-5.0.0 flatbuffers-2.0 gast-0.5.3 google-auth-2.6.2 google-auth-oauthlib-0.4.6 google-pasta-0.2.0 grpcio-1.45.0 importlib-metadata-4.11.3 keras-2.8.0 keras-preprocessing-1.1.2 libclang-13.0.0 markdown-3.3.6 oauthlib-3.2.0 opt-einsum-3.3.0 protobuf-3.19.4 pyasn1-0.4.8 pyasn1-modules-0.2.8 requests-oauthlib-1.3.1 rsa-4.8 tensorboard-2.8.0 tensorboard-data-server-0.6.1 tensorboard-plugin-wit-1.8.1 tensorflow-2.8.0 tensorflow-io-gcs-filesystem-0.24.0 termcolor-1.1.0 tf-estimator-nightly-2.8.0.dev2021122109
安装成功后可以用juypter查看自己安装的版本
import tensorflow as tf
print(tf.__version__)