主要参考这篇,不过还是遇到问题了感谢二位https://blog.csdn.net/darlingwood2013/article/details/60322258/
https://www.jianshu.com/p/03b4e49fd4bf
1、查一下自己的conda版本
(base) C:\Users\liu24>conda --version
conda 4.5.11
2、执行这个tensorflow的安装命令的关键
(base) C:\Users\liu24>conda create --name tensorflow python=3.7.0
Solving environment: done
3、激活tensorflow
(base) C:\Users\liu24>activate tensorflow
4、查conda的环境
(tensorflow) C:\Users\liu24>conda info --envs
conda environments: base C:\Users\liu24\Anaconda3
example C:\Users\liu24\Anaconda3\envs\example
tensorflow * C:\Users\liu24\Anaconda3\envs\tensorflow
5、查python的环境
(tensorflow) C:\Users\liu24>python --version
Python 3.7.0
6、关闭tensorflow
(tensorflow) C:\Users\liu24>deactivate
7、激活tensorflow
(base) C:\Users\liu24>activate tensorflow
8、安装
(tensorflow) C:\Users\liu24>pip install --upgrade pip
Collecting pip
Downloading https://files.pythonhosted.org/packages/d7/41/34dd96bd33958e52cb4da2f1bf0818e396514fd4f4725a79199564cd0c20/pip-19.0.2-py2.py3-none-any.whl (1.4MB)
100% |████████████████████████████████| 1.4MB 1.8MB/s
Installing collected packages: pip
Found existing installation: pip 19.0.1
Uninstalling pip-19.0.1:
Successfully uninstalled pip-19.0.1
Could not install packages due to an EnvironmentError: [WinError 5] 拒绝访问。: ‘c:\users\liu24\anaconda3\envs\tensorflow\-cripts\pip.exe’
Consider using the --user
option or check the permissions.
(tensorflow) C:\Users\liu24>pip install --upgarde tensorflow
(tensorflow) C:\Users\liu24>pip install --upgrade tensorflow
Collecting tensorflow
Downloading https://files.pythonhosted.org/packages/d4/78/8d1562ae84371798feba740b03fef2d813083aeba9a32ec1e3b1dbc0ac4a/tensorflow-1.13.0rc1-cp37-cp37m-win_amd64.whl (63.2MB)
100% |████████████████████████████████| 63.2MB 79kB/s
Collecting keras-applications>=1.0.6 (from tensorflow)
Downloading https://files.pythonhosted.org/packages/90/85/64c82949765cfb246bbdaf5aca2d55f400f792655927a017710a78445def/Keras_Applications-1.0.7-py2.py3-none-any.whl (51kB)
100% |████████████████████████████████| 61kB 122kB/s
Collecting termcolor>=1.1.0 (from tensorflow)
Downloading https://files.pythonhosted.org/packages/8a/48/a76be51647d0eb9f10e2a4511bf3ffb8cc1e6b14e9e4fab46173aa79f981/termcolor-1.1.0.tar.gz
Collecting protobuf>=3.6.1 (from tensorflow)
Downloading https://files.pythonhosted.org/packages/77/78/a7f1ce761e2c738e209857175cd4f90a8562d1bde32868a8cd5290d58926/protobuf-3.6.1-py2.py3-none-any.whl (390kB)
100% |████████████████████████████████| 399kB 86kB/s
Collecting tensorflow-estimator<1.14.0rc0,>=1.13.0rc0 (from tensorflow)
Downloading https://files.pythonhosted.org/packages/67/c1/3e8f58945f55769274e490d85df3bc4639ac258c60c6e3c6c7973d2a9e81/tensorflow_estimator-1.13.0rc0-py2.py3-none-any.whl (367kB)
100% |████████████████████████████████| 368kB 52kB/s
Collecting keras-preprocessing>=1.0.5 (from tensorflow)
Downloading https://files.pythonhosted.org/packages/c0/bf/0315ef6a9fd3fc2346e85b0ff1f5f83ca17073f2c31ac719ab2e4da0d4a3/Keras_Preprocessing-1.0.9-py2.py3-none-any.whl (59kB)
100% |████████████████████████████████| 61kB 60kB/s
Collecting absl-py>=0.1.6 (from tensorflow)
Downloading https://files.pythonhosted.org/packages/31/bc/ab68120d1d89ae23b694a55fe2aece2f91194313b71f9b05a80b32d3c24b/absl-py-0.7.0.tar.gz (96kB)
100% |████████████████████████████████| 102kB 55kB/s
Collecting numpy>=1.13.3 (from tensorflow)
Downloading https://files.pythonhosted.org/packages/41/b8/3a6b07352c2542ca1c89be7583e7ca07bf513895b6ac59ae008054f326b1/numpy-1.16.1-cp37-cp37m-win_amd64.whl (11.9MB)
100% |████████████████████████████████| 11.9MB 63kB/s
Collecting six>=1.10.0 (from tensorflow)
Downloading https://files.pythonhosted.org/packages/73/fb/00a976f728d0d1fecfe898238ce23f502a721c0ac0ecfedb80e0d88c64e9/six-1.12.0-py2.py3-none-any.whl
Collecting gast>=0.2.0 (from tensorflow)
Downloading https://files.pythonhosted.org/packages/4e/35/11749bf99b2d4e3cceb4d55ca22590b0d7c2c62b9de38ac4a4a7f4687421/gast-0.2.2.tar.gz
Requirement already satisfied, skipping upgrade: wheel>=0.26 in c:\users\liu24\anaconda3\envs\tensorflow\lib\site-packages (from tensorflow) (0.32.3)
Collecting astor>=0.6.0 (from tensorflow)
Downloading https://files.pythonhosted.org/packages/35/6b/11530768cac581a12952a2aad00e1526b89d242d0b9f59534ef6e6a1752f/astor-0.7.1-py2.py3-none-any.whl
Collecting grpcio>=1.8.6 (from tensorflow)
Downloading https://files.pythonhosted.org/packages/17/80/b135a60dfb12e9e0d691e4e66020b6f90fd8864e17ed5c719881bdea7d41/grpcio-1.18.0-cp37-cp37m-win_amd64.whl (1.5MB)
100% |████████████████████████████████| 1.5MB 100kB/s
Collecting tensorboard<1.13.0,>=1.12.0 (from tensorflow)
Downloading https://files.pythonhosted.org/packages/07/53/8d32ce9471c18f8d99028b7cef2e5b39ea8765bd7ef250ca05b490880971/tensorboard-1.12.2-py3-none-any.whl (3.0MB)
100% |████████████████████████████████| 3.1MB 269kB/s
Collecting h5py (from keras-applications>=1.0.6->tensorflow)
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘ProtocolError(‘Connection aborted.’, ConnectionResetError(10054, ‘远程主机强迫关闭了一个现有的连接。’, None, 10054, None))’: /simple/h5py/
Downloading https://files.pythonhosted.org/packages/4f/1e/89aa610afce8df6fd1f12647600a05e902238587ae6375442a3164b59d51/h5py-2.9.0-cp37-cp37m-win_amd64.whl (2.4MB)
100% |████████████████████████████████| 2.4MB 267kB/s
Requirement already satisfied, skipping upgrade: setuptools in c:\users\liu24\anaconda3\envs\tensorflow\lib\site-packages (from protobuf>=3.6.1->tensorflow) (40.7.3)
Collecting mock>=2.0.0 (from tensorflow-estimator<1.14.0rc0,>=1.13.0rc0->tensorflow)
Downloading https://files.pythonhosted.org/packages/e6/35/f187bdf23be87092bd0f1200d43d23076cee4d0dec109f195173fd3ebc79/mock-2.0.0-py2.py3-none-any.whl (56kB)
100% |████████████████████████████████| 61kB 139kB/s
Collecting markdown>=2.6.8 (from tensorboard<1.13.0,>=1.12.0->tensorflow)
Downloading https://files.pythonhosted.org/packages/7a/6b/5600647404ba15545ec37d2f7f58844d690baf2f81f3a60b862e48f29287/Markdown-3.0.1-py2.py3-none-any.whl (89kB)
100% |████████████████████████████████| 92kB 167kB/s
Collecting werkzeug>=0.11.10 (from tensorboard<1.13.0,>=1.12.0->tensorflow)
Downloading https://files.pythonhosted.org/packages/20/c4/12e3e56473e52375aa29c4764e70d1b8f3efa6682bef8d0aae04fe335243/Werkzeug-0.14.1-py2.py3-none-any.whl (322kB)
100% |████████████████████████████████| 327kB 140kB/s
Collecting pbr>=0.11 (from mock>=2.0.0->tensorflow-estimator<1.14.0rc0,>=1.13.0rc0->tensorflow)
Downloading https://files.pythonhosted.org/packages/8c/7f/fed53b379500fd889707d1f6e61c2a35e12f2de87396894aff89b017d1d6/pbr-5.1.2-py2.py3-none-any.whl (107kB)
100% |████████████████████████████████| 112kB 122kB/s
Building wheels for collected packages: termcolor, absl-py, gast
Building wheel for termcolor (setup.py) … done
Stored in directory: C:\Users\liu24\AppData\Local\pip\Cache\wheels\7c\06\54\bc84598ba1daf8f970247f550b175aaaee85f68b4b0c5ab2c6
Building wheel for absl-py (setup.py) … done
Stored in directory: C:\Users\liu24\AppData\Local\pip\Cache\wheels\90\db\f8\2c3101f72ef1ad434e4662853174126ce30201a3e163dcbeca
Building wheel for gast (setup.py) … done
Stored in directory: C:\Users\liu24\AppData\Local\pip\Cache\wheels\5c\2e\7e\a1d4d4fcebe6c381f378ce7743a3ced3699feb89bcfbdadadd
Successfully built termcolor absl-py gast
Installing collected packages: numpy, six, h5py, keras-applications, termcolor, protobuf, pbr, mock, absl-py, tensorflow-estimator, keras-preprocessing, gast, astor, grpcio, markdown, werkzeug, tensorboard, tensorflow
Successfully installed absl-py-0.7.0 astor-0.7.1 gast-0.2.2 grpcio-1.18.0 h5py-2.9.0 keras-applications-1.0.7 keras-preprocessing-1.0.9 markdown-3.0.1 mock-2.0.0 numpy-1.16.1 pbr-5.1.2 protobuf-3.6.1 six-1.12.0 tensorboard-1.12.2 tensorflow-1.13.0rc1 tensorflow-estimator-1.13.0rc0 termcolor-1.1.0 werkzeug-0.14.1
9、导入到python
(tensorflow) C:\Users\liu24>python
Python 3.7.0 (default, Jun 28 2018, 08:04:48) [MSC v.1912 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type “help”, “copyright”, “credits” or “license” for more information.
10、执行如下代码
【tensorflow安装】import tensorflow as tf
推荐阅读
- Keras|将Pytorch模型迁移到android端(android studio)【未实现】
- Tensorflow|Tensorflow学习笔记----梯度下降
- Tensorflow【branch-官网代码实践-Eager/tf.data/Keras/Graph】_8.19
- nlp|Keras(十一)梯度带(GradientTape)的基本使用方法,与tf.keras结合使用
- tensorflow|tf1.x究竟到底如何如何使用Embedding?
- python|Keras TensorFlow 验证码识别(附数据集)
- AI|bert实现端到端继续预训练
- Tensorflow|cuda由7.0升级到8.0
- tensorflow|利用Tensorflow的队列多线程读取数据
- 深度学习|conda源,tensorflow2,pytorch安装