随笔分类 -  python3 学习

摘要:安装依赖: debian 系统 build-essential yum groupinstall 'Development Tools' yum install -y ncurses-libs zlib-devel mysql-devel bzip2-devel openssl-devel ncur 阅读全文
posted @ 2019-02-27 09:29 Ray_lei 阅读(884) 评论(0) 推荐(0)
摘要:1、读取configparser 配置文件报错 : 提示: ConfigParser.MissingSectionHeaderError when parsing rsyncd config file with global options 解决方法: https://stackoverflow.c 阅读全文
posted @ 2019-01-10 18:28 Ray_lei 阅读(365) 评论(0) 推荐(0)
摘要:#元素聚焦 target = d.find_element_by_xpath(ele) d.execute_script("arguments[0].scrollIntoView();", target) #弹出框点击确认d.switch_to.alert.accept() #headless模式 阅读全文
posted @ 2018-11-30 11:08 Ray_lei 阅读(293) 评论(0) 推荐(0)
摘要:注意在pyspark中,要加载本地文件,必须采用“file:///”开头的这种格式执行第一条命令以后,并不会马上显示结果,因为,Spark采用惰性机制,只有遇到“行动”类型的操作,才会从头到尾执行所有操作。所以,下面我们执行一条“行动”类型的语句,就可以看到结果 eg: 执行: ./bin/kafk 阅读全文
posted @ 2018-10-24 11:26 Ray_lei 阅读(168) 评论(0) 推荐(0)
摘要:1、启动jupyter notebook报错: Hi, I have followed the install as described, but receive the following error on issuing 'jupyter notebook' File "/usr/local/l 阅读全文
posted @ 2018-10-18 10:13 Ray_lei 阅读(1185) 评论(0) 推荐(0)
摘要:以下操作均为使用非root用户进行。 vim ~/.bashrc 在文件中添加: export PYSPARK_PYTHON=/usr/local/bin/python3 指定pyspark启动时使用的python版本, #export PYSPARK_DRIVER_PYTHON=ipython3 阅读全文
posted @ 2018-10-18 10:08 Ray_lei 阅读(6940) 评论(0) 推荐(0)
摘要:1、 打印当前python 的安装包位置 python3: python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())" python2: python -c "from distutils. 阅读全文
posted @ 2018-10-10 16:22 Ray_lei 阅读(373) 评论(0) 推荐(0)
摘要:写好对文件流的监听脚本 执行ssc.start() 时报错显示: An error occurred while calling z:org.apache.spark.streaming.api.python.PythonDStream.callForeachRDD. 无法启动监听进程 在环境变量中 阅读全文
posted @ 2018-09-27 16:08 Ray_lei 阅读(747) 评论(0) 推荐(0)
摘要:Python Tips Beautiful Soup 许多值得注意和学习的python编程技巧的总结 http://book.pythontips.com/en/latest/index.html Beautiful Soup 4.2.0 中文文档, 用于解析网页的库 https://www.cru 阅读全文
posted @ 2018-09-20 16:22 Ray_lei 阅读(188) 评论(0) 推荐(0)
摘要:Python的enumerate函数是一个神话般的存在,以至于它很难用一句话去总结它的目的和用处。 但是,它是一个非常有用的函数,许多初学者,甚至中级Pythonistas是并没有真正意识到。简单来说,enumerate()是用来遍历一个可迭代容器中的元素,同时通过一个计数器变量记录当前元素所对应的 阅读全文
posted @ 2018-09-20 16:14 Ray_lei 阅读(280) 评论(0) 推荐(0)
摘要:最近开始跟随《子雨大数据之Spark入门教程(Python版)》 学习大数据方面的知识。 这里是网页教程的链接: http://dblab.xmu.edu.cn/blog/1709-2/ 在学习中遇到的一些问题,将会在这里进行总结,并贴上我的解决方法。 1、Spark独立应用程序编程时报错: 按照教 阅读全文
posted @ 2018-09-11 20:22 Ray_lei 阅读(6295) 评论(0) 推荐(0)
摘要:Python的and or操作 代码参考: 1 == 1 and 2 or 3 返回2 1 == 2 and 2 or 3 返回3 PS:习惯于if else的同学偶尔用下and or是不是会给人耳目一新的感觉。 and or 分开来用 [x] and 用法如下: 1 and 2 and 3 返回3 阅读全文
posted @ 2018-09-06 09:58 Ray_lei 阅读(238) 评论(0) 推荐(0)