keras环境搭建

目录

1. 安装miniconda

2. 安装CPU版本的tensorflow

2. 安装keras

3. 安装依赖库

4. 测试


环境:win10,无独立显卡,不用GPU加速。

1. 安装miniconda

Miniconda3-latest-Windows-x86_64.exe

(1)安装目录可自选,可以不用安装在C盘;(2)注意把这两个勾打上。

安装结束,打开miniconda终端,查询版本号:conda –version

显示版本号,说名安装成功,如下图:

 接下来需要在conda中安装各种依赖库。

2. 安装CPU版本的tensorflow

指令:pip install tensorflow-cpu==2.3.0 –i Simple Index

2. 安装keras

指令:pip install keras==2.4.3 –i Simple Index

3. 安装依赖库

指令:pip install pandas matplotlib notebook –i Simple Index

4. 测试

正确输出keras版本号。

(base) C:\Users\a>python

Python 3.7.6 (default, Jan  8 2020, 20:23:39) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32

Type "help", "copyright", "credits" or "license" for more information.

>>> import keras

>>> keras.__version__

'2.4.3'

>>> exit()

(base) C:\Users\a>

如果导出keras模块报错:

TypeError: Descriptors cannot not be created directly.

If this call came from a _pb2.py file, your generated code is out of date and must

be regenerated with protoc >= 3.19.0. If you cannot immediately

regenerate your protos, some other possible workarounds are:

1.Downgrade the protobuf package to 3.20.x or lower.

2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).

则需要卸载原来低版本的protobuf,重新安装新版本:

指令:pip install protobuf==3.19.0

猜你喜欢

转载自blog.csdn.net/qq_40088639/article/details/128470195