自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(71)
  • 收藏
  • 关注

原创 解决 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 828

原创 Javascript on-click传递参数

背景:在按button的时候,要求运行相应函数subfunc并传参代码:<input type="button" onClick="f(1)" /> f : function(e){ // 此时e就是传入的参数1}

2019-11-22 18:54:57 1254

原创 问题解决 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 1828 1

原创 Python 中的 __hash__

官方文档对 可哈希的解释:hashableAn object is hashable if it has a hash value which never changes during its lifetime (it needs a hash() method), and can be compared to other objects (it needs an eq() method). ...

2019-09-30 16:12:17 4812

原创 解决 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 25966

原创 解决 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 13037 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 661

原创 解决 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 14906

原创 解决 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 13690 1

原创 解决 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 13851 2

原创 解决 TensorFlow 报错 Segmentation fault (core dumped)

tensorflow运行过程中报错,Segmentation fault (core dumped)其中一个原因:tf.constant初始化DataFrame类型的数据。应该将DataFrame类型数据转化为array类型数据。

2019-03-12 14:44:12 7543

原创 解决 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.csdn.net/baidu_32936911/article/deta...

2019-03-12 12:10:28 46341 16

原创 解决 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的参数后,返回的文件类型为&lt;cla...

2019-02-28 19:10:30 7935

原创 解决 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 19168

原创 Python3中的zip()函数和*符号

zip()函数zip() 函数用于将可迭代的对象作为参数,将对象中对应的元素打包成一个个元组,然后返回由这些元组组成的列表。利用*操作符,可将元组表示为列表&gt;&gt;&gt; a = [1,2,3]&gt;&gt;&gt; b = [1,2,3,4,5,6]&gt;&gt;&gt; A = zip(a,b) #type(A):&lt;class 'zip'&gt;(1, 1),(...

2018-12-27 19:19:29 528

原创 nohup python 缓冲问题

在后台运行python命令时,会等到缓冲区满或者脚本结束后再输出。如要取消缓存,直接向屏幕输出,解决办法:运行时加-u参数 python3 -u添加环境变量 PYTHONUNBUFFERED=1Linux系统中 在print后刷新输出sys.stdout.flush()Postscript:默认向屏幕输出:stdout – 标准输出stderr – 标准错误输出官方文档解释...

2018-12-17 14:58:46 1150

原创 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 18775 1

原创 Python copy 模块 引用 浅拷贝 深拷贝

Python中一切都是对象,变量中存放的是对象的引用。引用(赋值)只是复制了原对象的引用,不会开辟新的内存空间。引用方式:= 赋值符号浅拷贝(shallow copy)是指原对象的引用拷贝。创建了新对象,其内容为原对象的引用。浅拷贝方式list[:]切片操作dict().copy() 字典的copy方法list(L) 内置函数copy.copy() copy模块函数...

2018-10-25 19:41:59 336

原创 解决 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 &lt;module&gt; 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 14890

原创 解决 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 15483 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 11454 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 5091 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 15490

原创 解决 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 1887

原创 Python3 List 初始化二维数组 踩坑记录

Python3中初始化一个多维数组,通过for range方法。以初始化二维数组举例:&gt;&gt;&gt; test = [[ 0 for i in range(2)] for j in range(3)]&gt;&gt;&gt; test[[0, 0], [0, 0], [0, 0]]初始一个一维数组,可以使用*&gt;&gt;&gt; test = [ 0 for i in...

2018-08-30 14:22:43 3874 1

原创 Python3 处理字符串中的空格

处理字符串首尾字符串 1. str.strip([char]) 删除字符串char字符 2. str.rstrip([char]) 删除字符串右边char字符 3. str.lstrip([char]) 删除字符串左边char字符 4. str.split(sep=None, maxsplit=-1) 切分字符串,maxsplit为-1时表示切分次数无限制 5. str.replace(...

2018-08-29 17:06:42 2160

原创 Python3 网络爬虫(三) 页面解析 BeautifulSoup模块

Python3 网络爬虫(一) urllib模块 Python3 网络爬虫(二) 正则表达式 re模块 安装pip install beautifulsoup4解析器常用的解析器:”html.parser” “lxml” [“lxml”, “xml”](能够解析XML) “html5lib”soup = BeautifulSoup(html, "html.p...

2018-08-16 20:04:03 829

原创 Python3 网络爬虫(二) 正则表达式 re模块

Python3 网络爬虫(一) urllib模块 正则表达式能检查一个字符串与特定模式是否匹配。python3中re模块具有正则表达式的全部功能。re模块函数 re.match(pattern,string,flags=0) 从字符串起始位置匹配模式 re.search(pattern,string,flags=0) 扫描整个字符串并返回第一个成功的匹配 re...

2018-08-15 18:19:58 460

原创 Python3 网络爬虫(一) urllib模块

通过urllib内置模块直接获取页面html数据,利用程序执行HTTP请求。 Urllib分为四个模块 urllib.request 请求模块 urllib.error 异常处理模块 比如404 urllib.parse url 解析模块 urllib.robotparser robots.txt解析模块写一个简单的例子:from urllib impo...

2018-08-14 18:21:51 450

原创 解决 编译错误 对‘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 3464

原创 解决 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 6337 2

原创 解决 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 18253

转载 记录 | 下载Windows 系统

1.访问目标地址 https://link.zhihu.com/?target=https%3A//www.microsoft.com/en-us/software-download/windows10ISO2.Chrome浏览器 console输入下列脚本:var _0x5c09=[&quot;product-edition&quot;,&quot;getElementById&quot;,&quot;innerHTML&quot;,&qu

2018-06-04 16:09:43 426

原创 解决 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 4250 6

原创 解决 TypeError: expected string or bytes-like object

报错如下:Traceback (most recent call last): File "*.py", line 37, in &lt;module&gt; html = get(URL, header) File "*.py", line 20, in get_HTML html = urllib.request.urlopen(request) File ...

2018-05-02 11:49:31 13694

原创 解决 AttributeError: module 'urllib' has no attribute 'request'

在python3下使用urllib包是报错如下:Traceback (most recent call last): File "*.py", line 34, in &lt;module&gt; html_page = get(URL, req_header) File "*.py", line 18, in get_HTML request = urllib.req...

2018-05-02 11:09:36 22437

原创 CRF++ 使用小结

下载CRF++并编译./configure`make编译成功即可训练模型命令行使用CRF++:(这里有更详细的Tutorial) 训练模型 crf_learn template_file train_file model_file crf_learn参数 -a CRF-L2 or CRF-L1 规范化算法选择。默认是CRF-L2。 -c float 其中float关于...

2018-04-29 23:02:19 1678

原创 RuntimeWarning -- 记EM算法踩的坑

在实现Baum_Welch算法过程中,能够训练小数据量参数,但是如果数据量增加时,多次迭代后会出现nan的数据。并且会报以下错误:RuntimeWarning: invalid value encountered in reduceRuntimeWarning: overflow encountered in true_divideRuntimeWarning: invalid val...

2018-04-12 16:58:55 3400 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 22447

原创 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 16622 3

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除