我已经尝试过多次使用Python 3.7.3和Anaconda安装Tensorflow,但每次都会收到相同的错误消息:
将tensorflow导入为tf
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
/anaconda3/envs/tf/lib/python3.7/site-packages/tensorflow/python/pywrap_tensorflow.py in <module>
57
---> 58 from tensorflow.python.pywrap_tensorflow_internal import *
59 from tensorflow.python.pywrap_tensorflow_internal import __version__
/anaconda3/envs/tf/lib/python3.7/site-packages/tensorflow/python/pywrap_tensorflow_internal.py in <module>
27 return _mod
---> 28 _pywrap_tensorflow_internal = swig_import_helper()
29 del swig_import_helper
/anaconda3/envs/tf/lib/python3.7/site-packages/tensorflow/python/pywrap_tensorflow_internal.py in swig_import_helper()
23 try:
---> 24 _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
25 finally:
/anaconda3/envs/tf/lib/python3.7/imp.py in load_module(name, file, filename, details)
241 else:
--> 242 return load_dynamic(name, filename, file)
243 elif type_ == PKG_DIRECTORY:
/anaconda3/envs/tf/lib/python3.7/imp.py in load_dynamic(name, path, file)
341 name=name, loader=loader, origin=path)
--> 342 return _load(spec)
343
ImportError: dlopen(/anaconda3/envs/tf/lib/python3.7/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so, 6): Symbol not found: _clock_gettime
Referenced from: /anaconda3/envs/tf/lib/python3.7/site-packages/tensorflow/python/../libtensorflow_framework.so (which was built for Mac OS X 10.13)
Expected in: /usr/lib/libSystem.B.dylib
in /anaconda3/envs/tf/lib/python3.7/site-packages/tensorflow/python/../libtensorflow_framework.so
During handling of the above exception, another exception occurred:
我卸载了Python,Tensorflow和Anaconda,但无法继续进行。我也将Python降级到3.6.3,但是它不能解决问题。我真的不知道了。我遵循了我们大学的安装指南。
我正在使用Mac OS X 10.11.6。好的,我已经更新了Mac,但现在出现了这个问题:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-2-3538944ef98e> in <module>
1 #guarantee fixed seeds for comparability
2 np.random.seed(42)
----> 3 tf.random.set_random_seed(42)
AttributeError: module 'tensorflow._api.v2.random' has no attribute 'set_random_seed'
这是安装指南:1