python - 通过安装了 python 的终端在 macOS 上运行 Keras?
问题描述
当我在 macOS 上的终端中键入命令“从 tensorflow 导入 keras”时,我得到
“来自:无法读取 /var/mail/tensorflow”
解决方案
您不能直接将 Python 代码写入 CLI。这只在某种程度上接受shell命令。
您可以:
- 从 CLI 启动 Python 解释器并直接使用它,例如
$ python3
Python 3.9.4 (default, Apr 5 2021, 01:50:46)
[Clang 12.0.0 (clang-1200.0.32.29)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from tensorflow import keras
- 或将所有代码写入文本文件并将其命名为
my_first_script.py
,例如
#!/usr/bin/env python3
import tensorflow as tf
from tensorflow import keras
# the rest of your code
然后你用python运行它,例如
$ python my_first_script.py
在这里查看本教程。
推荐阅读
- android - 使用 Kotlin 在 Android Studio 中搜索附近的地方
- javascript - 试图找到详尽的事件列表(如“点击”)
- firebase - 在flutter中调用函数时for循环只执行一次
- amazon-web-services - 如何加快从 AWS S3 下载数百万个文件的速度
- django - 我的 Django 应用在 localhost 上通过了身份验证,但在 heroku 上没有通过
- oracle - 输入清理 - 数值
- ruby-on-rails - 将 ActionCable 与服务对象一起使用并响应消息
- javascript - 根据订阅的变量应用 CSS 属性。暗模式与亮模式
- java - 为什么连接到服务器后websocket客户端用户会话为空
- php - SQL中的多次插入,数据库中的经常性费用插入