python如何安装keras和tensorflow
pip安装keras的方法
·
目录
一. 通过pip install kears 安装 keras
通过windows+R按键组合,进入cmd终端,按以下命令操作即可。
C:\Users\zgd>pip install keras
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.HTTPSConnection object at 0x0000010B93ED30D0>, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/keras/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.HTTPSConnection object at 0x0000010B93EC6E20>, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/keras/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.HTTPSConnection object at 0x0000010B93EC6BE0>, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/keras/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.HTTPSConnection object at 0x0000010B93EC6BB0>, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/keras/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.HTTPSConnection object at 0x0000010B93EC6A00>, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/keras/
Collecting keras
Downloading keras-2.9.0-py2.py3-none-any.whl (1.6 MB)
|████████████████████████████████| 1.6 MB 1.1 MB/s
Installing collected packages: keras
Successfully installed keras-2.9.0
C:\Users\zgd>python --version
Python 3.8.5
二. 安装tensorflow
安装完之后,运行程序,
from keras.datasets import imdb
(train_data, train_labels), (test_data, test_labels) = imdb.load_data(num_words=10000)
1.报错 No module named ‘tensorflow’
ModuleNotFoundError: No module named 'tensorflow'
C:\Users\54867>pip install tensorflow
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.HTTPSConnection object at 0x000001CE290EE100>, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/tensorflow/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.HTTPSConnection object at 0x000001CE290E4F10>, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/tensorflow/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.HTTPSConnection object at 0x000001CE290E4D30>, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/tensorflow/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.HTTPSConnection object at 0x000001CE290E4BE0>, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/tensorflow/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.HTTPSConnection object at 0x000001CE290E48E0>, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/tensorflow/
ERROR: Could not find a version that satisfies the requirement tensorflow (from versions: none)
ERROR: No matching distribution found for tensorflow
2.同样的操作,换个时间段操作,部分成功
只是末尾提示
查看pip list
没有找到tensorflow,意味着安装失败。
3.重复步骤2,成功安装tensorflow
提示安装成功:
4. Ignore above cudart dlerror if you do not have a GPU set up on your machine
更多推荐
已为社区贡献28条内容
所有评论(0)