安装任何环境
1、版本冲突
别整pip install tensorflow=1.4啥的,需要自己配版本很容易出问题
应该装个conda
conda install tensorflow=1.13.1 直接一键适配安装(cuda/cudnn都自动配置)
实在conda install找不到才用pip指定版本安装(情况很少)
Tensorflow
1、IndentationError: unexpected indent
代码缩进有问题
2、TypeError: Fetch argument 5 has invalid type <class 'int'>, must be a string or Tensor. (Can not convert a int into a Tensor or Operation.)
把int32 换成float32
3、Tensor("Add:0", shape=(), dtype=float32)
因为你还没输出
session = tf.compat.v1.Session()
print(session.run(y))
session.close()
Pytorch报错集合
1、ModuleNotFoundError: No module named 'past'
conda install future
2、FutureWarning: Passing (type, 1) or '1type' as a synon
版本太高
conda uninstall numpy
conda install numpy=1.16.0
3、TensorBoard logging requires TensorBoard with Python summary writer installed.
一般都是tensorboard版本和tensorflow有问题,后面会有提示,卸载之前的再安装就是了
4、zsh: illegal hardware instruction tensorboard --logdir logs(Mac)
多半没有装tensorflow
conda install tensorflow
5、requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8097):
安装超时,换下载源
pip install grpcio-tools -i https://pypi.doubanio.com/simple
6、EOFError: Compressed file ended before the end-of-stream marker was reached
数据集下载有问题,删除重新下载
dgango报错集合
1、AttributeError: ‘str’ object has no attribute ‘decode’
点最后一个报错地方文件,将decode改为encode
在一起的报错三连:完美解决python manage.py makemigrations 报错_xbean1028的博客-CSDN博客
2、与mysql交互控制台不乱码,浏览器乱码
添加json_dumps_params={'ensure_ascii': False}
return JsonResponse({'code': 1, 'data': contents}, json_dumps_params={'ensure_ascii': False})
3、 django post方法403报错
在settings.py里面的MIDDLEWARE_CLASSES中去掉“‘django.middleware.csrf.CsrfViewMiddleware’,”