ModuleNotFoundError: No module named 'tensorflow'
注意一下,确定你在跑脚本时候的python版本,假如是mac用户,由于mac本身自带低版本的python,所以python xxx.py默认是python2.x的版本,而正确的应该是根据你安装虚拟环境时候选择的python编译版本来,假如是python3,就用python3 xxx.py来执行
AttributeError: module 'tensorflow' has no attribute 'Session'
假如你是tensorflow2.x的,
tf.Session()
已经在2.0被废弃了, 请把hello world换成以下的内容,在2.0中已经可以直接使用print来打出constant内容。
import tensorflow as tf
msg = tf.constant('TensorFlow 2.0 Hello World')
tf.print(msg)
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate
假如你用了virtualenv,请在 env/lib/python3.x/site-packages/tensorflow_core/python/keras/utils/data_utils.py的导入语句下加入以下代码片段,
import requests
requests.packages.urllib3.disable_warnings()
import ssl
try:
_create_unverified_https_context = ssl._create_unverified_context
except AttributeError:
# Legacy Python that doesn't verify HTTPS certificates by default
pass
else:
# Handle target environment that doesn't support HTTPS verification
ssl._create_default_https_context = _create_unverified_https_context
未完待续....
网友评论