簡體   English   中英

通過安裝了 python 的終端在 macOS 上運行 Keras?

[英]running Keras on macOs through the terminal with python installed?

當我在 macOS 上的終端中鍵入命令“從 tensorflow 導入 keras”時,我得到

“來自:無法讀取 /var/mail/tensorflow”

您不能直接將 Python 代碼寫入 CLI。 那在某種程度上只接受 shell 命令。

您可以:

  1. 從您的 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
  1. 或將所有代碼寫入文本文件並將其命名為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

在這里查看本教程

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM