【AutoML】AutoKeras 的安装和环境配置(VSCode)

2023-11-01 13:01

本文主要是介绍【AutoML】AutoKeras 的安装和环境配置(VSCode),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

本地环境中已经有太多的工作配置了(Python、Java、Maven、Docker 等等),为了不影响其他环境运行,我选择直接在 VSCode 中创建工作空间并配置好 AutoKeras(反正最后也是要在 VSCode 中进行开发的)。

打开 VSCode 后先创建一个工作区,然后在终端运行以下代码:

python3 -m venv autokeras-env

这段代码会在工作区创建一个名为 autokeras-env 的工作环境,之后所有 autokeras 插件都在这个工作环境里面安装。接下来就要在终端中执行以下代码激活 autokeras-env 环境:

source autokeras-env/bin/activate

当终端上出现了以下输出后

MacBook-Pro:python yuanzhenhui$ python3 -m venv autokeras-env
MacBook-Pro:python yuanzhenhui$ source autokeras-env/bin/activate
(autokeras-env) MacBook-Pro:python yuanzhenhui$

就证明已经切换完毕了,接下来就可以去安装 autokeras 插件了。

pip install autokeras

在第一次安装的时候或许会出现这样的报错,如下图:

...
Collecting grpcio<2.0,>=1.24.3Downloading grpcio-1.59.2.tar.gz (24.8 MB)|████████████████████████████████| 24.8 MB 2.1 MB/s ERROR: Command errored out with exit status 1:command: /Users/yuanzhenhui/Documents/code_space/git/processing/python/autokeras-env/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/74/mmb55nf927x36pb3bv43_zd40000gn/T/pip-install-rtnah99l/grpcio/setup.py'"'"'; __file__='"'"'/private/var/folders/74/mmb55nf927x36pb3bv43_zd40000gn/T/pip-install-rtnah99l/grpcio/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/74/mmb55nf927x36pb3bv43_zd40000gn/T/pip-pip-egg-info-nbp93pfccwd: /private/var/folders/74/mmb55nf927x36pb3bv43_zd40000gn/T/pip-install-rtnah99l/grpcio/Complete output (9 lines):Traceback (most recent call last):File "<string>", line 1, in <module>File "/private/var/folders/74/mmb55nf927x36pb3bv43_zd40000gn/T/pip-install-rtnah99l/grpcio/setup.py", line 95, in <module>import commandsFile "/private/var/folders/74/mmb55nf927x36pb3bv43_zd40000gn/T/pip-install-rtnah99l/grpcio/src/python/grpcio/commands.py", line 31, in <module>import supportFile "/private/var/folders/74/mmb55nf927x36pb3bv43_zd40000gn/T/pip-install-rtnah99l/grpcio/src/python/grpcio/support.py", line 111, in <module>errors.CompileError: diagnose_compile_error,AttributeError: module 'setuptools.errors' has no attribute 'CompileError'----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
WARNING: You are using pip version 20.2.1; however, version 23.3.1 is available.
You should consider upgrading via the '/Users/yuanzhenhui/Documents/code_space/git/processing/python/autokeras-env/bin/python3 -m pip install --upgrade pip' command.

从上面的提示得知,若遇到这样的报错只需要重新安装一下 pip 应该就可以了。如下图;

(autokeras-env) MacBook-Pro:python yuanzhenhui$ python3 -m pip install --upgrade pip
Collecting pipUsing cached pip-23.3.1-py3-none-any.whl (2.1 MB)
Installing collected packages: pipAttempting uninstall: pipFound existing installation: pip 20.2.1Uninstalling pip-20.2.1:Successfully uninstalled pip-20.2.1
Successfully installed pip-23.3.1

之后再重新执行 pip install autokeras

(autokeras-env) MacBook-Pro:python yuanzhenhui$ pip install autokeras
Collecting autokerasUsing cached autokeras-1.1.0-py3-none-any.whl (148 kB)
Collecting packaging (from autokeras)Using cached packaging-23.2-py3-none-any.whl.metadata (3.2 kB)
...Downloading tensorflow-2.13.1-cp38-cp38-macosx_10_15_x86_64.whl (216.2 MB)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 216.2/216.2 MB 150.3 kB/s eta 0:00:00
Using cached packaging-23.2-py3-none-any.whl (53 kB)
Downloading pandas-2.0.3-cp38-cp38-macosx_10_9_x86_64.whl (11.7 MB)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 11.7/11.7 MB 124.0 kB/s eta 0:00:00
Using cached absl_py-2.0.0-py3-none-any.whl (130 kB)
Using cached flatbuffers-23.5.26-py2.py3-none-any.whl (26 kB)
Downloading grpcio-1.59.2-cp38-cp38-macosx_10_10_universal2.whl (9.6 MB)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 9.6/9.6 MB 251.9 kB/s eta 0:00:00
Downloading h5py-3.10.0-cp38-cp38-macosx_10_9_x86_64.whl (3.2 MB)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.2/3.2 MB 2.8 MB/s eta 0:00:00
...
Downloading importlib_metadata-6.8.0-py3-none-any.whl (22 kB)
Downloading MarkupSafe-2.1.3-cp38-cp38-macosx_10_9_x86_64.whl (13 kB)
Downloading zipp-3.17.0-py3-none-any.whl (7.4 kB)
Installing collected packages: pytz, namex, libclang, kt-legacy, flatbuffers, dm-tree, zipp, wrapt, wheel, urllib3, tzdata, typing-extensions, termcolor, tensorflow-io-gcs-filesystem, tensorflow-estimator, tensorboard-data-server, six, regex, pygments, pyasn1, protobuf, packaging, oauthlib, numpy, mdurl, MarkupSafe, keras, idna, grpcio, gast, charset-normalizer, certifi, cachetools, absl-py, werkzeug, rsa, requests, python-dateutil, pyasn1-modules, opt-einsum, markdown-it-py, importlib-metadata, h5py, google-pasta, astunparse, rich, requests-oauthlib, pandas, markdown, google-auth, keras-core, google-auth-oauthlib, tensorboard, keras-tuner, keras-nlp, tensorflow, autokeras
Successfully installed MarkupSafe-2.1.3 absl-py-2.0.0 astunparse-1.6.3 autokeras-1.1.0 cachetools-5.3.2 certifi-2023.7.22 charset-normalizer-3.3.1 dm-tree-0.1.8 flatbuffers-23.5.26 gast-0.4.0 google-auth-2.23.3 google-auth-oauthlib-1.0.0 google-pasta-0.2.0 grpcio-1.59.2 h5py-3.10.0 idna-3.4 importlib-metadata-6.8.0 keras-2.13.1 keras-core-0.1.5 keras-nlp-0.6.1 keras-tuner-1.4.5 kt-legacy-1.0.5 libclang-16.0.6 markdown-3.5 markdown-it-py-3.0.0 mdurl-0.1.2 namex-0.0.7 numpy-1.24.3 oauthlib-3.2.2 opt-einsum-3.3.0 packaging-23.2 pandas-2.0.3 protobuf-4.24.4 pyasn1-0.5.0 pyasn1-modules-0.3.0 pygments-2.16.1 python-dateutil-2.8.2 pytz-2023.3.post1 regex-2023.10.3 requests-2.31.0 requests-oauthlib-1.3.1 rich-13.6.0 rsa-4.9 six-1.16.0 tensorboard-2.13.0 tensorboard-data-server-0.7.2 tensorflow-2.13.1 tensorflow-estimator-2.13.0 tensorflow-io-gcs-filesystem-0.34.0 termcolor-2.3.0 typing-extensions-4.5.0 tzdata-2023.3 urllib3-2.0.7 werkzeug-3.0.1 wheel-0.41.3 wrapt-1.15.0 zipp-3.17.0

之后我们可以通过以下命令查看已经安装的 keras 的版本来确定是否已经正常安装了

(autokeras-env) MacBook-Pro:autokeras-env yuanzhenhui$ python
Python 3.8.6 (v3.8.6:db455296be, Sep 23 2020, 13:31:39) 
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import keras
2023-11-01 10:26:26.153780: I tensorflow/core/platform/cpu_feature_guard.cc:182] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
To enable the following instructions: AVX2 FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.
>>> print(keras.__version__)
2.13.1

至此基础安装已完成。

这篇关于【AutoML】AutoKeras 的安装和环境配置(VSCode)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/323171

相关文章

Zookeeper安装和配置说明

一、Zookeeper的搭建方式 Zookeeper安装方式有三种,单机模式和集群模式以及伪集群模式。 ■ 单机模式:Zookeeper只运行在一台服务器上,适合测试环境; ■ 伪集群模式:就是在一台物理机上运行多个Zookeeper 实例; ■ 集群模式:Zookeeper运行于一个集群上,适合生产环境,这个计算机集群被称为一个“集合体”(ensemble) Zookeeper通过复制来实现

CentOS7安装配置mysql5.7 tar免安装版

一、CentOS7.4系统自带mariadb # 查看系统自带的Mariadb[root@localhost~]# rpm -qa|grep mariadbmariadb-libs-5.5.44-2.el7.centos.x86_64# 卸载系统自带的Mariadb[root@localhost ~]# rpm -e --nodeps mariadb-libs-5.5.44-2.el7

Centos7安装Mongodb4

1、下载源码包 curl -O https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel70-4.2.1.tgz 2、解压 放到 /usr/local/ 目录下 tar -zxvf mongodb-linux-x86_64-rhel70-4.2.1.tgzmv mongodb-linux-x86_64-rhel70-4.2.1/

hadoop开启回收站配置

开启回收站功能,可以将删除的文件在不超时的情况下,恢复原数据,起到防止误删除、备份等作用。 开启回收站功能参数说明 (1)默认值fs.trash.interval = 0,0表示禁用回收站;其他值表示设置文件的存活时间。 (2)默认值fs.trash.checkpoint.interval = 0,检查回收站的间隔时间。如果该值为0,则该值设置和fs.trash.interval的参数值相等。

NameNode内存生产配置

Hadoop2.x 系列,配置 NameNode 内存 NameNode 内存默认 2000m ,如果服务器内存 4G , NameNode 内存可以配置 3g 。在 hadoop-env.sh 文件中配置如下。 HADOOP_NAMENODE_OPTS=-Xmx3072m Hadoop3.x 系列,配置 Nam

wolfSSL参数设置或配置项解释

1. wolfCrypt Only 解释:wolfCrypt是一个开源的、轻量级的、可移植的加密库,支持多种加密算法和协议。选择“wolfCrypt Only”意味着系统或应用将仅使用wolfCrypt库进行加密操作,而不依赖其他加密库。 2. DTLS Support 解释:DTLS(Datagram Transport Layer Security)是一种基于UDP的安全协议,提供类似于

Centos7安装JDK1.8保姆版

工欲善其事,必先利其器。这句话同样适用于学习Java编程。在开始Java的学习旅程之前,我们必须首先配置好适合的开发环境。 通过事先准备好这些工具和配置,我们可以避免在学习过程中遇到因环境问题导致的代码异常或错误。一个稳定、高效的开发环境能够让我们更加专注于代码的学习和编写,提升学习效率,减少不必要的困扰和挫折感。因此,在学习Java之初,投入一些时间和精力来配置好开发环境是非常值得的。这将为我

阿里开源语音识别SenseVoiceWindows环境部署

SenseVoice介绍 SenseVoice 专注于高精度多语言语音识别、情感辨识和音频事件检测多语言识别: 采用超过 40 万小时数据训练,支持超过 50 种语言,识别效果上优于 Whisper 模型。富文本识别:具备优秀的情感识别,能够在测试数据上达到和超过目前最佳情感识别模型的效果。支持声音事件检测能力,支持音乐、掌声、笑声、哭声、咳嗽、喷嚏等多种常见人机交互事件进行检测。高效推

【Python编程】Linux创建虚拟环境并配置与notebook相连接

1.创建 使用 venv 创建虚拟环境。例如,在当前目录下创建一个名为 myenv 的虚拟环境: python3 -m venv myenv 2.激活 激活虚拟环境使其成为当前终端会话的活动环境。运行: source myenv/bin/activate 3.与notebook连接 在虚拟环境中,使用 pip 安装 Jupyter 和 ipykernel: pip instal

安装nodejs环境

本文介绍了如何通过nvm(NodeVersionManager)安装和管理Node.js及npm的不同版本,包括下载安装脚本、检查版本并安装特定版本的方法。 1、安装nvm curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash 2、查看nvm版本 nvm --version 3、安装