When I type the command, 'from tensorflow import keras' into the terminal on macOS, I get
"from: can't read /var/mail/tensorflow"
You can't just write Python code into the CLI directly. That only accepts shell commands to some extent.
You can either:
$ 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
, eg#!/usr/bin/env python3
import tensorflow as tf
from tensorflow import keras
# the rest of your code
Then you run that with python, eg
$ python my_first_script.py
Check out this tutorial here.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.