[Edit-01] A comment told me to run print(tensorflow.__file__)
and the result is None
This is the simplest code in Tensorflow (directly from website)
import tensorflow as tf
g = tf.Graph()
with g.as_default():
# Define operations and tensors in `g`.
c = tf.constant(30.0)
assert c.graph is g
And this is what I am getting
% /usr/local/bin/python3 /Users/-----/Downloads/eye_contact_gaze_correction-master/gaze_correct
ion_system/things.py
Traceback (most recent call last):
File "/Users/-----/Downloads/eye_contact_gaze_correction-master/gaze_correction_system/things.py", line 2, in <module>
g = tf.Graph()
AttributeError: module 'tensorflow' has no attribute 'Graph'
On a side note, when I am trying to do pip install tensorflow
, it will always show this error message:
ERROR: Could not find a version that satisfies the requirement tensorflow (from versions: none)
ERROR: No matching distribution found for tensorflow
However, when I do pip list
,this happened:
...
SQLAlchemy 1.4.32
stack-data 0.2.0
statsmodels 0.13.2
sympy 1.10.1
tables 3.6.1
tabulate 0.8.9
TBB 0.2
tblib 1.7.0
tenacity 8.0.1
tensorboard 2.9.1
tensorboard-data-server 0.6.1
tensorboard-plugin-wit 1.8.1
tensorflow 2.9.1
tensorflow-estimator 2.9.0
tensorflow-io-gcs-filesystem 0.26.0
termcolor 1.1.0
terminado 0.13.1
testpath 0.5.0
text-unidecode 1.3
textdistance 4.2.1
threadpoolctl 2.2.0
three-merge 0.1.1
tifffile 2021.7.2
tinycss 0.4
...
So apparently tensorflow was installed but it just can't run modules? I tried many things, such as anaconda, apple's tensorflow-metal, and directly downloading the tensorflow file, but none of those works.
M1 Macbook air
Python 3.10.0
How could I get tf.graph to work?
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.