Python
1
File “/home/XXX/Code/…”, line 50, in init
self.input_shape = input_shape
File “/home/XXX/.local/lib/python3.7/site-packages/tensorflow/python/keras/engine/base_layer.py”, line 1639, in setattr
super(Layer, self).setattr(name, value)
AttributeError: can’t set attribute
- 解决方案
被赋值的变量与super的属性重名了,且其不是一个setter,更改一下变量名,改为“self.inputShape = input_shape”就可以了。
参考链接
2
Pycharm/Python OpenCV and CV2 install error
ERROR: Could not find a version that satisfies the requirement cv2 (from versions: none)
ERROR: No matching distribution found for cv2
- 解决方案
You are getting those errors because opencv and cv2 are not the python package names.
These are both included as part of the opencv-python package available to install from pip.
https://stackoverflow.com/questions/37776228/pycharm-python-opencv-and-cv2-install-error
3
File “h5py/_objects.pyx”, line 54, in h5py._objects.with_phil.wrapper
File “h5py/_objects.pyx”, line 55, in h5py._objects.with_phil.wrapper
File “h5py/h5f.pyx”, line 78, in h5py.h5f.open
OSError: Unable to open file (file signature not found)
- 解决方案
源文件下载的时候有问题,在网页从download进再下载一次;检查上一次访问该文件时是否用close()正常关闭了
https://github.com/h5py/h5py/issues/757
4
OSError: Driver write request failed (file write failed: time = Mon May 27 10:45:48 2019
, filename = ‘shapes_20x20/16_32/result_4.h5’, file descriptor = 24, errno = 28, error message = ‘No space left on device’, buf = 0x564b1eef09e6, total write size = 13279, bytes this sub-write = 13279, bytes actually written = 18446744073709551615, offset = 92549120)
- 解决方案
通过命令 sudo du -h --max-depth=1,查看内存使用情况,清理一下内存
5
FutureWarning: The behavior of AMI will change in version 0.22. To match the behavior of ‘v_measure_score’, AMI will use average_method=‘arithmetic’ by default.
- 解决方案:使用
from sklearn.metrics.cluster import adjusted_mutual_info_score adjusted_mutual_info_score(labels_true, labels_pred, average_method='arithmetic')
命令行
1
linux下-bash: ***: command not found
- 解决方案
一般就是最近添加PATH路径的时候没有写对,一种直接的方法就是进入 /etc 文件夹,用文本编辑修改正确profile文件,可能会提示没有权限修改,复制到别的文件夹改好后再copy回来;或者参考下面的链接
linux下-bash: ***: command not found解决办法
2
使用‘./run.sh’命令出现错误:running shell script: command not found
- 解决方案(参考自https://www.linuxquestions.org/questions/red-hat-31/running-shell-script-command-not-found-202062/)
先通过 chmod u+x run.sh 给权限,再./run.sh