- 博客(136)
- 收藏
- 关注
原创 zsh: no matches found: pix2tex[gui]
编程环境:conda create -n latex python=3.8。操作系统:MacOS Monterey 12.6.5。文件下载至或放至该目录后,就可以单机使用了,重新输入。下载好直接放在下面的那个路径(可以在。
2023-06-28 23:53:13
396
原创 AttributeError: ‘charset_normalizer‘ has no attribute ‘md__mypyc‘
编程环境:conda create -n tf python=3.9。错误描述:导入 TensorFlow GPU 时,键入“操作系统:MacOS Monterey 12.6.5。
2023-04-21 12:04:05
7537
7
原创 Mac上使用VScode运行C/C++
1、在官网下载VScode-stable安装包2、把解压出来的这东西拖到这里3、在启动台打开VScode,然后点这4、然后在搜索框里搜索下载这几个扩展5、设置中文按组合键command+shift+P输入language点[Configure Display language]-点[zh-cn]点[restart]等待软件重启6、配置run-code点击左下角的齿轮⚙️ , 点设置输入run code,点击Run Code co…(22)(确保有选中的黑体样式)自行
2020-11-09 17:29:38
5539
8
原创 C语言之基础语法
C语言的注释;在C语言中,换行并不影响代码的运行。/* 这里是注释 *//* 这里是多行注释*/所有的 C 程序都需要包含 main() 函数。#include<stdio.h> /* C 的标准库,包括了输入(scanf)输出(printf)等函数 */ int main() /* 代码的执行从 main() 函数开始。 */{ /* {}用于表示函数代码块的开始和结束 */ return 0; /* retu
2020-09-16 08:47:58
240
原创 Mac上Jupyter的使用(Python3和C语言)
安装Homebrew(随后按提示操作):/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"安装Python3:brew install python3安装Jupyther:sudo pip3 install jupyter显示Jupyter的配置文件:jupyter notebook --generate-config修改默认目录(否则为当前目录):复制配置文
2020-09-14 16:17:30
1485
原创 Kivy之Config应用配置
from kivy.config import ConfigConfig.getint('kivy', 'desktop')方法说明add_callback(callback,section = None,key = None )添加在节点或键已更改时要调用的回调adddefaultsection(section)添加一个节点get(section,option,** kwargs)获取节点的选项值getdefault(section,option,defa
2020-06-26 15:20:41
1081
1
原创 Kivy之Button按钮
代码:import kivykivy.require("1.9.1")from kivy.app import Appfrom kivy.uix.button import Buttonclass ButtonApp(App): def build(self): btn = Button(text ="这时一个按钮", # 文本 font_size ="20sp",
2020-06-25 17:37:29
4666
2
原创 Kivy之BoxLayout布局
代码:import kivykivy.require("1.9.1")from kivy.app import Appfrom kivy.uix.label import Labelfrom kivy.uix.boxlayout import BoxLayoutclass BoxLayoutApp(App): def build(self): HB = BoxLayout(orientation='horizontal') # 定义盒子,并设置内部的部件水平排列
2020-06-25 14:54:43
1529
原创 Kivy之Label标签标记markup
class LabelApp(App): def build(self): return Label(text = "这是一个[sub]标签[/sub]", font_size = '120sp', # px、dp、sp单位 color = [0.5, 0.5, 1, 1], # RGBA色彩 markup = True)label = La
2020-06-23 11:22:28
1182
原创 Kivy之Lable及Mac下中文乱码
# 导入kivy库import kivy# 使用的版本即当前版本kivy.require("1.11.1")# 我们所创建的App类要继承的父类from kivy.app import App# 我们所创建的App要用到的Label部件from kivy.uix.label import Label# 定义一个App类class TestApp(App): def build(self): # 显示标签的文本 return Label(text
2020-06-22 14:16:44
644
原创 Mac系统下安装kivy
Kivy是Python的一个图形用户界面开源库,可以在Windows、macOS、Android、iOS、Linux等开发多平台应用程序。为便于开发,本人使用的是Mac系统。下面开始安装Kivy:1.安装HomebrewHomebrew是一款macOS系统的包管理工具。terminal命令:/usr/bin/ruby -e "$(curl -fsSL https://cdn.jsdelivr.net/gh/ineo6/homebrew-install/install)"如果执行时出现:==
2020-06-22 13:48:35
1561
原创 python之webdriver的鼠键操作
from selenium import webdriver # 网络驱动from selenium.webdriver import ActionChains # 鼠标动作链from selenium.webdriver.common.keys import Keys # 键盘模拟from selenium.webdriver.comm...
2019-10-15 13:49:58
250
原创 python之selenium.webdriver函数
使用的phantomjs2.1.1浏览器from selenium import webdriverdriver=webdriver.PhantomJS(executable_path=r"C:\phantomjs-2.1.1-windows\bin\phantomjs.exe")方法说明driver.get(url)打开页面driver.forward()前...
2019-10-14 17:19:30
614
原创 python进阶学习之路
函数和装饰器函数全局变量递归函数匿名函数闭包装饰器带参的装饰器常用的函数范围函数时间函数日历函数随机函数map函数reduce函数文件文件备份批量重命名类和模块类的创建 类的构造函数类的封装
2019-10-13 16:02:16
568
原创 python高级学习之路
正则表达式正则表达式match函数search函数 Match对象findal函数finditer函数compile函数sub函数split函数正则标志位和模式 网络爬虫爬取页面(urllib库) 爬取邮箱电话 爬取贴吧翻译 多线程编程多线程编程 Thread对threadin
2019-10-13 15:59:47
283
原创 python之多线程爬取笑话
from bs4 import BeautifulSoup as bsimport requests,json,timefile = open("duanzi.json", "a")def crawl_html(num): headers={"User-Agent":"Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:69.0) Gecko/20...
2019-10-12 15:27:27
280
原创 python之三角函数
acos(x)返回x的反余弦弧度值。asin(x)返回x的反正弦弧度值。atan(x)返回x的反正切弧度值。atan2(y, x)返回给定的 X 及 Y 坐标值的反正切值。cos(x)返回x的弧度的余弦值。hypot(x, y)返回欧几里德范数 sqrt(xx + yy)。sin(x)返回的x弧度的正弦值。tan(x)返...
2019-10-12 14:47:23
1090
原创 python之数学函数
abs(x)返回数字的绝对值,如abs(-10) 返回 10ceil(x)返回数字的上入整数,如math.ceil(4.1) 返回 5cmp(x, y)如果 x < y 返回 -1, 如果 x == y 返回 0, 如果 x > y 返回 1exp(x)返回e的x次幂(ex),如math.exp(1) 返回2.718281828459045...
2019-10-12 14:47:08
203
原创 HTTPResponse对象
使用urllib.request模块中的urlopen()方法发送http请求import urllibresponse=urllib.request.urlopen('http://www.baidu.com') # 服务器返回的响应内容封装在HTTPResponse类型的对象中print(type(response)) # HTTPResp...
2019-10-12 14:46:30
731
原创 urllib实现数据传输
import urlliburl='https://blog.youkuaiyun.com/GrofChen/article/details/91492052'headers={'User-Agent':'Mozilla/5.0 (Window NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safar...
2019-10-12 14:46:17
363
原创 python之lxml.etree模块
from lxml import etree # 导入etree模块root=etree.Element('root',interesting='totatlly') # 创建一个节点对象,即标签对象,节点名为root,节点属性为interestingroot.set('set','30') # 添加节点属性,属性名为setroot.text='data' ...
2019-10-12 14:45:35
4839
原创 python之beautifulSoup
html_doc = """<html><head><title>The dormouse's story</title></head><body><p class="title"><b>The Dormouse's story</b></p><p class="...
2019-10-12 14:45:22
157
原创 python之json模块及jsonpath
import jsonimport jsonpathstr_list='[1,2,3,4]'str_dict='{"city":"绍兴"}'list_=json.loads(str_list) # loads时将json数据变成python数据dict_=json.loads(str_dict) # loads与load的区别是loads对字符串...
2019-10-12 14:45:09
304
原创 python之爬取页面
爬取百度首页import urllib.request # 调用urllib库的request模块respone=urllib.request.urlopen('http://www.baidu.com') # 打开百度页面html=respone.read().decode('UTF-8') ...
2019-10-12 14:44:43
444
原创 python之爬取笑话
from bs4 import BeautifulSoup as bsimport requests,json,timefile = open("duanzi.json", "a")def crawl_html(num): headers={"User-Agent":"Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:69.0) Gecko/20...
2019-10-12 14:43:57
425
原创 python之多线程爬取绍兴e网招聘信息
import threading,urllib,jsonfrom queue import Queue from bs4 import BeautifulSoup as bsCRAWL_EXIT = Falseclass ThreadCrawl(threading.Thread): def __init__(self,threadName,pageQueue,dataQueue):...
2019-09-30 16:38:44
351
原创 python之selenium库的webdriver.phantomjs()遇到的坑
问题:warnings.warn('Selenium support for PhantomJS has been deprecated, please use headless ’解决办法因为新版本不支持phantom.js,卸载selenium后,装个低版本的selenium,我装的是2.48.0问题:module ‘selenium.webdriver’ has no attrib...
2019-09-29 08:12:49
9059
原创 python之爬取小说
from bs4 import BeautifulSoup as bsimport urllibclass Spider(object): def __init__(self): self.base_url='https://www.biquge.com.cn' def load_page(self,url): headers={"User-Ag...
2019-09-27 08:52:03
323
原创 python之爬取绍兴e网招聘信息
from bs4 import BeautifulSoup as bsimport urllibimport reclass Spider(object): def __init__(self): print('init') self.begin_page=1 self.end_page=4 self.base_url=...
2019-09-25 20:06:53
722
原创 python之爬取邮箱电话
这里使用requests库爬取网页要比urllib库方便用finditer查询import requestsimport reurl='https://www.flyai.com/' # 带爬取的网页html=requests.get(url).text # text为转化为str数据pat='(\w+@\w+.com)|(\d{11})' # 正则模式res=re.findite...
2019-09-18 15:39:33
2103
原创 python之爬取百度贴吧
有道翻译import urllib.requestimport urllib.parseurl='http://fanyi.youdao.com/translate?smartresult=dict&smartresult=rule' # 有道翻译错误代码50时,去掉translate_o?的_oheaders={"User-Agent":"Mozilla/5.0 (Windo...
2019-09-16 16:56:23
317
原创 python之urllib库
urllib库是python内置的http请求库,包含四个模块:urllib.request:请求模块urllib.error:异常处理模块urllib.parse:URL解析模块urllib.robotparser:robots.txt模块robots.txt是Robots协议(网络爬虫排除协议),是互联网界通行的道德模范,基于以下原则:搜索技术应服务于人类,同时尊重信息提供者...
2019-09-09 16:39:14
198
原创 python之愚蠢的线程
即便我什么都不做,只要调用了线程,结果竟然不是0from threading import Threadvalue=0def val(): passp1=Thread(target=val)p1.start()print(value)正在研究中···
2019-07-15 22:29:55
173
原创 python之Thread对象
Thread对象的属性import threadingfrom time import sleep,ctimedef pri(py,n): name=p1.name # 线程名 id=p1.ident # 线程标识符 for i in range(n): print(...
2019-07-09 20:15:49
474
原创 python之threadingh函数及对象
threading模块中的对象对象说明Thread执行线程的对象Lock锁原语对象RLock可重入锁对象(递归锁)Condition条件变量特定对象Event条件变量通用对象Semaphore为共享资源提供计数器BoundedSemaphore不得超过初始值的计数器Timer延迟性执行线程对象Barrier限制...
2019-07-09 18:41:39
494
原创 python之多线程编程
程序是可执行的二进制文件。进程是执行中的程序。有自己的地址空间、内存、数据线及其他辅助数据。可以派生新的进程,进程间数据独立,通过进程间通信的方式共享信息。线程是主进程中的小进程。进程内共享同一片数据空间,线程包括开始,执行顺序,结束。可以被其他线程中断和临时挂起。在多线程编程前,只能同时运行一个线程。...
2019-07-04 22:36:05
210
原创 python之正则表达式
正则表达式用于检查一个字符串是否匹配某种模式在python中正则表达式的功能包含在re模块中import re函数说明re.match(正则表达式,字符串【,标志位】)检查字符串的开头是否匹配正则表达式re.search(正则表达式,字符串【,标志位】)检查整个字符串里是否匹配正则表达式re.subre.compilere.findite...
2019-07-02 17:30:11
187
原创 python之正则标志位和模式
修饰符说明re.I使匹配对大小写不敏感re.L做本地化识别(locale-aware)匹配re.M多行匹配,影响 ^ 和 $re.S使 . 匹配包括换行在内的所有字符re.U根据Unicode字符集解析字符。这个标志影响 \w, \W, \b, \B.re.X该标志通过给予你更灵活的格式以便你将正则表达式写得更易于理解。模...
2019-06-25 19:25:10
562
1
原创 python之findal函数finditer函数
findall()函数,检查整个字符串,符合正则表达式的子字符串返回在一个列表中,没有匹配到则是空列表。格式:re.findall(表达式, 字符串【,标志位】)import rea ='a1b2c3d4e5f6's = re.findall('\d',a) print(s)finditer()函数与findall()函数类似,不过返回的不是列表,而是一个迭代器格式:re.fin...
2019-06-25 16:39:02
3365
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人