
问题解决
Jaichg
这个作者很懒,什么都没留下…
展开
-
解决 glib库报错 error: non-floating-point argument in call to function '__builtin_isnan'
编译,glib文件下bd.h 报错,错误如下:./glib/bd.h:43:19: error: non-floating-point argument in call to function ‘__builtin_isnan’#define _isnan(x) isnan(x)解决办法:修改bd.h文件中代码: #define _isnan(x) isnan((float)x)...原创 2019-12-30 15:52:04 · 894 阅读 · 0 评论 -
问题解决 InvalidArgumentError (see above for traceback): You must feed a value for placeholder tensor
报错如下:Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMATraceback (most recent call last):File “/root/anaconda3/lib/python3.6/site-packages/tensorflow/pyth...原创 2019-11-22 18:25:21 · 1883 阅读 · 1 评论 -
nohup python 缓冲问题
在后台运行python命令时,会等到缓冲区满或者脚本结束后再输出。如要取消缓存,直接向屏幕输出,解决办法:运行时加-u参数 python3 -u添加环境变量 PYTHONUNBUFFERED=1Linux系统中 在print后刷新输出sys.stdout.flush()Postscript:默认向屏幕输出:stdout – 标准输出stderr – 标准错误输出官方文档解释...原创 2018-12-17 14:58:46 · 1240 阅读 · 0 评论 -
shell脚本 报错 Command not found 常见问题
1.shell脚本中变量名和等号之间是不允许有空格test = 'ps aux | grep -v grep | wc -l' #报错代码正确代码需要删除等号之间的空格test='ps aux | grep -v grep | wc -l' #正确代码2.if 判定条件中空格if [$test -eq 1] #报错代码 echo $testfi正确代码需要在[和]前后添加...原创 2018-11-06 16:04:15 · 19194 阅读 · 1 评论 -
解决 UnicodeEncodeError: 'ascii' codec can't encode characters in position 16-20: ordinal not in range
python中因编码问题报错:Traceback (most recent call last): File "a*.py", line 61, in <module> m*w.a*b() File "a*e.py", line 50, in a print (ab)UnicodeEncodeError: 'ascii' codec can't encode...原创 2018-10-24 14:12:04 · 15005 阅读 · 0 评论 -
解决 anaconda 报错 ModuleNotFoundError: No module named 'lightgbm'
通过pip install lightgbm安装lightgbm成功,import lightgbm报错:ModuleNotFoundError: No module named ‘lightgbm’原因:lightgbm默认安装在本地python环境中,而anaconda的python路径与本地路径不同,不能使用本地环境中的包,因此无法在anaconda jupyter noteboo...原创 2018-10-16 09:48:53 · 15946 阅读 · 3 评论 -
解决 IndexError: arrays used as indices must be of integer (or boolean) type
使用sklearn处理数据,进行数据标签分类转化,报错如下:Traceback (most recent call last):File “.py", line 67, in pa = le.ina(pa)File "/rel.py”, line 14, in informreturn s*s_[y]IndexError: arrays used as indices must be...原创 2018-10-11 14:38:31 · 11536 阅读 · 5 评论 -
解决 pymysql : AttributeError: 'NoneType' object has no attribute 'encode'
pymysql连结mysql数据库时报错:AttributeError: 'NoneType' object has no attribute 'encode'错误原因:pymysql.connect()中charset为’utf8’而不是’utf-8’配置文件key值加了单引号pymysql连结数据库:import pymysqltry: self.conn = pymysq...原创 2018-10-11 14:20:30 · 5222 阅读 · 1 评论 -
解决 ImportError: cannot import name 'abs' 导入tensorflow报错
python3导入tensorflow时import tensorflow报错如下:ImportError: cannot import name 'abs'原因:protobuf和tensorflow发生了冲突解决方法:删除tensorflow所有模块(包括-gpu)pip uninstall tensorflow删除protobufpip uninstall protobu...原创 2018-09-19 18:59:35 · 15660 阅读 · 0 评论 -
解决 MySql插入表 中文显示为乱码或者问号
问题: 1.插入MySql数据库中文字符时,中文显示为? 2.报Incorrect String value的错误原因: 数据库字符没有统一设置成为UTF-8解决方法: 1.查看Mysql数据库字符集show variables like 'char%'; 显示编码格式,检查是否更正为utf-82.修改MySql配置文件my.cnf Linux下是...原创 2018-09-06 14:51:11 · 1981 阅读 · 0 评论 -
解决 AttributeError: module 'matplotlib' has no attribute 'artist'
报错语句:import pandas as pdAttributeError: module ‘matplotlib’ has no attribute ‘artist’原因:没有安装matplotlib,重新安装即可。conda uninstall matplotlibconda install matplotlibReference:https://github.com/...原创 2019-01-16 18:48:30 · 19231 阅读 · 0 评论 -
解决 TypeError: 'TextFileReader' object is not subscriptable
使用pandas读物文件报错:Traceback (most recent call last):data[“a”] = data[“a”].astype(str)TypeError: ‘TextFileReader’ object is not subscriptable报错原因:pandas中read_csv()函数,添加chunksize=n的参数后,返回的文件类型为<cla...原创 2019-02-28 19:10:30 · 8163 阅读 · 0 评论 -
解决 TypeError: unhashable type: 'list'
报错代码行: index = dictionary[words]TypeError: unhashable type: 'list'错误原因:Python中不支持dict()的key为list或者dict类型,因为list()和dict()是不可哈希的。那么哪些是可哈希的,哪些是不可哈希的?可哈希: int, float, str, tuple不可哈希: list, set...原创 2019-07-31 23:03:56 · 26133 阅读 · 0 评论 -
解决 ValueError: Shape of passed values is (7, 5), indices imply (7, 3)
Exception:Traceback (most recent call last):File “”, line 1, in File “ncat.py”, line 226, in concatreturn op.get_result()File “at.py”, line 423, in get_resultcopy=self.copy)File “ernals.py”, li...原创 2019-06-29 17:22:35 · 13178 阅读 · 2 评论 -
解决 ValueError: Initializer type and explicit dtype
运行Tensorflow代码,报错如下:ValueError: Initializer type '<dtype: 'string'>' and explicit dtype '<dtype: float32’>’解决方法:修改tensorflow安装。将1.8.0 升级为 1.9.0 程序可正常运行。...原创 2019-05-31 19:56:45 · 698 阅读 · 0 评论 -
解决 ValueError: Can only compare identically-labeled Series object
报错如下:File “/root/anaconda3/lib/python3.6/site-packages/pandas/core/ops.py”, line 1676, in wrapperraise ValueError("Can only compare identically-labeled "ValueError: Can only compare identically-la...原创 2019-04-10 14:25:40 · 15296 阅读 · 0 评论 -
解决 TensorFlow 报错 Segmentation fault (core dumped)
tensorflow运行过程中报错,Segmentation fault (core dumped)其中一个原因:tf.constant初始化DataFrame类型的数据。应该将DataFrame类型数据转化为array类型数据。原创 2019-03-12 14:44:12 · 7685 阅读 · 0 评论 -
解决 tensorflow.python.framework.errors_impl.InternalError: Could not find valid device for node.
运行tensorflow程序,报错如下:tensorflow.python.framework.errors_impl.InternalError: Could not find valid device for node.Node: {{node FusedBatchNorm}}All kernels registered for op FusedBatchNorm :device=‘...原创 2019-03-20 19:29:37 · 13757 阅读 · 1 评论 -
解决 ImportError: libcublas.so.10.0: cannot open shared object file: No such file
运行import tensorflow时报错:ImportError: libcublas.so.10.0: cannot open shared object file: No such file原因:tensorflow版本与CUDA的版本不对应Reference:查看CUDA版本:https://blog.youkuaiyun.com/baidu_32936911/article/deta...原创 2019-03-12 12:10:28 · 46414 阅读 · 16 评论 -
解决 tensorflow.python.framework.errors_impl.InternalError: Blas GEMM launch failed
运行tensorflow时报错如下:tensorflow.python.framework.errors_impl.InternalError: Blas GEMM launch failed : a.shape=(1, 10), b.shape=(10, 2), m=10, n=2, k=10 [Op:MatMul]原因:GPU被占用。tensorflow sess = tf.Sessio...原创 2019-03-16 14:43:52 · 13938 阅读 · 2 评论 -
解决 Ubuntu apt-get update 报错E: Sub-process returned an error code
在Ubantu中输入命令sudo apt-get update 报错如下:正在读取软件包列表... 完成E: Problem executing scripts APT::Update::Post-Invoke-Success 'if /usr/bin/test -w /var/cache/app-info -a -e /usr/bin/appstreamcli; then appst...原创 2018-07-27 22:28:20 · 6806 阅读 · 2 评论 -
解决 编译错误 对‘sem_init’未定义的引用 collect2: error: ld returned 1 exit status <builtin>: recipe for
执行$ make(gcc -Wall -g -O0 -c p*v.c)(gcc -lpthread p*v.o c*p.o -o p*v)报错如下 p*v.o:在函数‘init’中: /media/psf/p*v.c:187:对‘sem_init’未定义的引用 c*p.o:在函数‘Pthread_create’中: /media/psf/c*p.c:...原创 2018-07-31 20:23:07 · 3550 阅读 · 0 评论 -
解决 ImportError: cannot import name '__version__'
使用brew升级python后,报了command not found: pip3的错误,并且使用pip时会出现另外一个错误: Traceback (most recent call last): File “/usr/local/bin/pip”, line 7, in from pip._internal import main File “/usr...原创 2018-06-24 15:04:10 · 18670 阅读 · 0 评论 -
ImportError: `save_model` requires h5py.
keras 入门报了如下错误 ImportError: save_model requires h5py. 解决方法pip install --upgrade h5py原创 2017-12-01 17:13:26 · 14501 阅读 · 0 评论 -
Mac brew更新后 command not found: python
更新Homebrewbrew upgradePython2.7.10升级到Python2.7.14 结果在命令行输入python后,显示command not found: python探究原因,发现是因为使用brew安装的python更新为python2(在电脑中已安装python3),输入python2可以进入python。进入/usr/local/bin/目录,发现下列已变更为python2原创 2017-12-01 17:24:04 · 6290 阅读 · 0 评论 -
解决 tensorflow softmax_cross_entropy_with_logits() 报错 Only call `softmax_cross_entropy_with_logits`
运行程序报错:Traceback (most recent call last): File "demo.py", line 74, in <module> cost = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits(pred, y)) File "/python2.7/site-packages/tensorflow/原创 2017-12-21 23:47:48 · 6558 阅读 · 0 评论 -
ValueError: Cannot feed value of shape (64, 10) for Tensor u'Placeholder_1:0', whichhas shape '(10,
报错如下: Traceback (most recent call last): File “…/”, line 69, in sess.run(optimizer, feed_dict={x: batch_xs, y: batch_ys, keep_prob: dropout}) File “…/python2.7/site-packages/tensorflow/pyt原创 2017-12-23 15:35:57 · 19035 阅读 · 4 评论 -
AttributeError: 'module' object has no attribute 'merge_all_summaries'
AttributeError: ‘module’ object has no attribute ‘merge_all_summaries’ 原始代码merged_summary_op = tf.merge_all_summaries()修改为merged_summary_op = tf.summary.merge_all()AttributeError: ‘module’ object has原创 2017-12-22 19:39:43 · 3579 阅读 · 2 评论 -
python3.6 ModuleNotFoundError ConfigParser
Python2与Python3不同之处 pip3 install configparser 安装成功 仍然会报如下错误Traceback (most recent call last): File "code_counter.py", line 4, in <module> import ConfigParserModuleNotFoundError: No mo...原创 2018-02-27 21:50:57 · 9138 阅读 · 4 评论 -
CLion相对路径 未找到相应文件
使用CLion中ifstream、fopen打开文件,文件名正确,但是文件均无法打开原因: 在CLion工程中 编译文件放在cmake-build-debug文件夹中 此时使用相对路径"./(relative path)"是在cmake-build-debug文件夹下寻找文件需要回到代码文件同目录下的相对路径 因此回到父目录 "../(relative path)" 即可调用成功...原创 2018-02-28 14:31:53 · 4974 阅读 · 0 评论 -
cannot pass non-trivial object of type 'string' to variadic function
Scanning dependencies of target algorithm [ 50%] Building CXX object CMakeFiles/aaa.cpp.o error: cannot pass non-trivial object of type ‘string’ (aka ’ basic_string< char, char_traits< char ...原创 2018-02-28 16:19:08 · 8016 阅读 · 0 评论 -
Keras TypeError: run() got an unexpected keyword argument 'class_mode'
keras报错 keras入门原创 2017-12-01 17:02:22 · 2946 阅读 · 0 评论 -
解决 Mac 上安装 Xgboost Python库报错
需要使用Python跑一些模型 直接使用 pip install xgboost安装,会报如下错误: Command "python setup.py egg_info" failed with error code 1 于是查找相应资料,使用Git成功安装。步骤如下:cd ~ git clone --recursive https://github.com/dmlc/xgboost原创 2017-12-01 17:18:56 · 1685 阅读 · 0 评论 -
解决 AttributeError: 'module' object has no attribute 'convolution'
Keras报错 - AttributeError: 'module' object has no attribute 'convolution' 解决记录在OSX上第一次使用pip安装如下的whl,在tensorflow中运行正常,但是在keras中运行程序会抱 AttributeError: 'module' object has no attribute 'convolution'的错误。pip原创 2017-12-01 17:21:56 · 3452 阅读 · 0 评论 -
解决 ImportError: module 'pip' has no attribute 'main'
升级pip10.0.0报错如下: Traceback (most recent call last): File “/usr/local/lib/python3.6/site-packages/pkg_resources/init.py”, line 2332, in resolve return functools.reduce(getattr, self.attrs, mod...原创 2018-05-03 22:21:22 · 4298 阅读 · 6 评论 -
解决 TypeError: expected string or bytes-like object
报错如下:Traceback (most recent call last): File "*.py", line 37, in <module> html = get(URL, header) File "*.py", line 20, in get_HTML html = urllib.request.urlopen(request) File ...原创 2018-05-02 11:49:31 · 13852 阅读 · 0 评论 -
解决 AttributeError: module 'urllib' has no attribute 'request'
在python3下使用urllib包是报错如下:Traceback (most recent call last): File "*.py", line 34, in <module> html_page = get(URL, req_header) File "*.py", line 18, in get_HTML request = urllib.req...原创 2018-05-02 11:09:36 · 23782 阅读 · 0 评论 -
RuntimeWarning -- 记EM算法踩的坑
在实现Baum_Welch算法过程中,能够训练小数据量参数,但是如果数据量增加时,多次迭代后会出现nan的数据。并且会报以下错误:RuntimeWarning: invalid value encountered in reduceRuntimeWarning: overflow encountered in true_divideRuntimeWarning: invalid val...原创 2018-04-12 16:58:55 · 3475 阅读 · 2 评论 -
TypeError: unsupported operand type(s) for /: 'NoneType' and 'float'
Traceback (most recent call last): File “xxxxx.py”, line 16, in print (float(a) - 0.01) / main_std TypeError: unsupported operand type(s) for /: ‘NoneType’ and ‘float’Reason: 缺少括号。在python...原创 2018-04-03 12:36:26 · 22619 阅读 · 0 评论 -
TypeError: Failed to convert object of type
Traceback (most recent call last): File "/usr/local/lib/python3.6/site-packages/tensorflow/python/framework/tensor_util.py", line 468, in make_tensor_proto str_values = [compat.as_bytes(x) for x...原创 2018-03-26 20:16:14 · 16729 阅读 · 3 评论