自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(45)
  • 问答 (1)
  • 收藏
  • 关注

原创 使用pyinstaller 打包成可执行程序

使用pyinstaller打包可执行程序的相关步骤及官方文档链接

2022-10-11 12:42:30 339

原创 【已解决】pyinstaller打包的app闪退

解决mac 及windows系统下,使用pyinstaller打包可执行程序闪退的问题

2022-10-11 12:41:23 903

原创 【笔记】python函数中指定输入和输出格式

def foo() - > int : # foo 的返回值为int类a : str # a的类型为str。

2022-09-06 16:06:26 952 1

原创 【笔记】python中用def __repr__(self)为类定义输出格式

在 Python 中,可以通过在类中定义__repr__() 方法来指定一个对象的文本表述。函数,类创建后,当创建Robot实例时,打印一个Robot对象时,__repr__()方法会被自动调用,文本表示会显示在控制台。

2022-09-06 15:40:55 1024

原创 【笔记】pyinstaller 封装含GUI的背景图及软件icon

如果希望将图片共同打包,需将原直接调用图片的路径改为相对路径。在希望为app 捆绑数据文件时,可以通过更改*.spec文件实现

2022-08-27 21:55:36 1189

原创 macOS “应用程序不能打开”

右键*.app打开“显示包内容”-“contents” - “MacOS”更改该应用的权限在终端中输入:chmod +x (+x前后空格) 加应用文件路径更改安全性,运行该app 运行

2022-05-26 17:55:01 1763

原创 【已解决】报错“Exception: Jupyter command `jupyter-notebook` not found“ 及 not on PATH 问题(bash_profile配置)

mac os1.pip install notebook 安装Installing Jupyterpip install notebook2. 安装jupyter 后,报错jupyter-notebook not found参考报错“Exception: Jupyter command jupyter-notebook not found“ 重新安装。pip3 install --upgrade --force-reinstall --no-cache-dir jupyter3. 出现pe

2022-05-09 17:31:34 3240

原创 为conda 创建的虚拟环境定义python 版本

系统python 版本为3.8.5使用conda 创建Python==3.7.12的环境tensorflow1后,调用时仍为3.8.5。(tensorflow1) Rachel1900 (master #) ~$ which python/Users/Rachel1900/anaconda3/envs/tensorflow1/bin/python#路径正确(tensorflow1) Rachel1900 (master #) ~$ python --versionPython 3.8.5#

2022-05-09 14:46:34 788

原创 【已解决】mac打开terminal自动激活base环境

每次打开terminal总自动激活base(base) Rachel1900 (master #) ~$ conda info -e# conda environments:#base * /Users/Rachel1900/anaconda3tensorflow1 /Users/Rachel1900/anaconda3/envs/tensorflow1关掉办法:在terminal 运行conda config --set au

2022-05-07 18:45:33 556

原创 【已解决】使用conda 创建虚拟环境后python 版本无法正确调用

问题原环境为python3.8,为安装tensorflow 1* ,使用conda 创建python 3.7 的虚拟环境tensorflow1。激活虚拟环境后,python调用的仍为python 3.8。问题如下:python路径正确(tensorflow1) Rachel1900 (master #) ~$ which python/Users/Rachel1900/anaconda3/envs/tensorflow1/bin/python但执行版本错误,且当前环境下库无法调用(ten

2022-05-07 18:37:45 6479 3

原创 conda重置或恢复base环境

原始环境及位置Rachel1900 (master #) ~$ conda info -e # conda environments:#base * /Users/Rachel1900/anaconda3创建新环境Rachel1900 (master #) ~$ conda create --name=IntroToTensorFlow python=3 anaconda==> WARNING: A newer version of conda

2022-05-07 13:37:49 12794

原创 AttributeError: module ‘enum‘ has no attribute ‘IntFlag‘

使用pyinstaller 封装时报错:AttributeError: module 'enum' has no attribute 'IntFlag'pre-safe-import-module hook failed, needs fixing.

2022-03-13 12:51:39 1640

原创 mac上用pyinstaller 生成exe无法实现

多次尝试均失败,查找stackoverflow ,回答同为无法实现pyinstaller generate exe on mac

2022-03-13 12:46:50 794

翻译 git- git diff & git ignore

git diffgit diff 命令可以用来查看已被加入但是尚未提交的更改。$ git diff此命令会显示:已经修改的文件添加/删除的行所在的位置执行的实际更改git log -p 其实就是在后台使用了 git diffgitignore如果想将某个文件保留在项目的目录结构中,但是确保它不会意外地提交到项目中,可以使用名称特殊的文件 .gitignore(注意文件名开头的点,很重要!)。将此文件添加到 new-git-project项目根目录。将需要ignore 的文件添加

2021-08-06 15:37:05 205

原创 git版本控制【2】- git add & git commit

1.暂存 git addgit add 命令用于将文件从工作目录移到暂存区。$ git add <file1> <file2> … <fileN>此命令:可接受多个文件名(用空格分隔)此外,可以使用句点 . 来代替文件列表,告诉 git 添加当前目录至暂存区(以及所有嵌套文件)暂存剩余的文件$ git add .句点.句点指代当前目录,可以用来表示所有文件和目录(包括所有嵌套文件和目录!) ```bash $ git add cs

2021-08-06 15:06:58 167

原创 git 版本控制- git log 相关命令

terminal 命令ls - 用来列出文件和目录mkdir - 用来新建目录cd - 用来更改目录rm - 用来删除文件和目录git loggit log 命令用于显示仓库中所有 commit 的信息。$ git log默认情况下,该命令会显示仓库中每个 commit 的:SHA作者 author日期 data消息 commitgit 使用命令行分页器 less 浏览所有信息。less 的重要快捷键要按行向下滚动,使用 j 或 ↓要按行向上滚动,使

2021-08-06 14:25:57 2113

原创 git 终端配置mac(udacity)

安装 GitMac OS 实际上已经安装了 Git,但可以重新安装,以便使用最新的版本:转到 https://git-scm.com/downloads下载 Mac 版软件安装 Git 并选择所有默认选项安装完毕后,在命令行工具中运行 git。如果显示了使用信息,则一切正常配置将下载的目录 udacity-terminal-config 移到主目录下,并命名为.udacity-terminal-config(注意前面有个点)将 bash_profile 文件移到你的主目录下,并命名

2021-08-06 10:57:33 503

原创 error: (-210:Unsupported format or combination of formats) [Start]FindContours supports only CV_8UC1

----> 2 contours=cv2.findContours(binary,cv2.RETR_TREE,cv2.CHAIN_APPROX_SIMPLE)error: OpenCV(4.5.2) /private/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/pip-req-build-6ogwzase/opencv/modules/imgproc/src/contours.cpp:197: error: (-210:Unsupported f

2021-06-23 19:15:12 2735

原创 【python】使用pytesseract 读取图片信息(ocr)

步骤:pytesseract 安装tesseract 安装pytesseract 读取图片1. pytesseract 安装pytesseract$ pip3 install pytesseract -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com2. tesseract 安装2.1 mac tesseract-OCR的安装安装有四种方式:brew install --with-training-

2021-02-04 21:39:03 214

原创 python-获取当前路径下的文件

os.path.dirname(path)去掉文件名,返回目录os.path.dirname(_file_):当"print os.path.dirname(_file_)"所在脚本是以完整路径被运行的,将输出该脚本所在的完整路径当"print os.path.dirname(_file_)"所在脚本是以相对路径被运行的, 将输出空目录示例:import osdef read_file(file_name,save_name):#read info from file_name

2021-02-04 21:24:33 262

原创 python 判断字符是否是中文

判断是否是中文def is_Chinese(word): for ch in word: if '\u4e00' <= ch <= '\u9fff': return True

2021-02-04 21:23:23 316

原创 pandas 数据nan清洗

使用“==”对比 两dataframe发现存在“NaN == NaN”时结果为false,因此需要先替换dataframe中的NaN”原excel 文件读入后:1. 使用dataframe.applymap()自定义处理方法def replce_nan(df): df=df.applymap(lambda x: x if str(x) != 'nan' else None) return df结果如下,仅部分nan被替换。使用df.dtypes 查看原数据格式,发现是obje

2021-02-04 21:22:13 294

原创 【已解决】pandas_reindex 将dataframe中的值转为里nan

问题:需要重新定义dataframe的index,使用reindex后原dataframe的值全部变为nandf.reindex(index_list)原因分析:参考official docConform Series/DataFrame to new index with optional filling logic.Places NA/NaN in locations having no value in the previous index. A new object is produ

2020-12-29 09:46:28 2283 3

原创 imutils简介

imutils简介pypi.org/project/imutilsimutils是Adrian Rosebrock开发的一个python工具包,它整合了opencv、numpy和matplotlib的相关操作,主要是用来进行图形图像的处理,如图像的平移、旋转、缩放、骨架提取、显示等等,后期又加入了针对视频的处理,如摄像头、本地文件等。imutils同时支持python2和python3。pip3 install imutils -i http://pypi.douban.com/simple --tr

2020-12-24 23:23:53 5189

原创 【解决】nltk.download()报错:errno54: connection reset by peer

报错详情>>> nltk.download('')[nltk_data] Error loading : <urlopen error [Errno 54] Connection reset[nltk_data] by peer>解决方案离线安装NLTK Data文件1.下载NLTK DataGithub https://github.com/nltk/nltk_data/tree/gh-pages 下载得到nltk_data-gh-pages.zip

2020-12-24 23:23:00 1529 1

原创 python--nltk库预处理德语文本

标准化文本:import nltkfrom nltk.corpus import stopwordsset(stopwords.words('german'))德语停止词:NLTK词形还原(Lemmatization)NLTK用法总结

2020-12-24 11:19:46 1397 4

原创 使用python 调用MoviePy制作GIF动图

MoviePyMoviePy (full documentation) is a Python library for video editing: cutting, concatenations, title insertions, video compositing (a.k.a. non-linear editing), video processing, and creation of custom effects. See the gallery for some examples of us

2020-12-22 18:27:37 1699 1

原创 ERROR: Cannot uninstall ‘imageio‘. It is a distutils installed project and thus we cannot accurately

安装moviepy时报错:Installing collected packages: imageio-ffmpeg, imageio, MoviePy Attempting uninstall: imageio Found existing installation: imageio 2.4.1ERROR: Cannot uninstall ‘imageio’. It is a distutils installed project and thus we cannot accurate

2020-12-22 14:49:22 949

原创 【解决】atom -安装emmet 后keybinding 不起作用

尝试多种办法后仍未解决,按照官方debug手册,将atom 恢复至factory状态官方问答:debugging/#check-the-keybindingsatom 恢复至factory状态#清除个人设置$ mv ~/.atom ~/.atom-backup#该命令并未完全删除文件,而是将文件移动至~/.atom-backup#可前往查找恢复#$ open ~/.atom-backup> Tip: The command given above doesn't delete the

2020-11-30 12:36:40 169

原创 atom-package 安装缓慢,手动安装

根据udemy angela yu 的课程推荐,使用atom 编辑器学习web development,编辑器atom 包安装缓慢,使用git 复制安装Atom PackagesRecommendedatom-beautifyatom-ternjsautoclose-htmlemmetcsslintpigmentslanguage-ejsOptional Packagesatom-html-previewSublime-Style-Column-Selectionlin

2020-11-27 14:45:01 440

原创 mac-环境配置文件zsh及bash环境变量配置

切换shell$chsh -s /bin/zsh$chsh -s/bin/bash环境配置文件bash 的环境配置文件为:.bash_profilezsh 的环境配置文件为:.zshrc环境配置文件编辑创建.bash_profile文件:touch .bash_profile打开.bash_profile并编辑:open .bash_profile写入文件:echo 'export PATH="/usr/local/opt/node@10/bin:$PATH"' >&gt

2020-11-27 13:33:22 2299

原创 【解决】mac os系统下dlopen(...):Library not loaded: @loader_path/.dylibs/libxcb.1.1Reason: image not found

错误描述:使用py2app构建os 独立应用程序,测试模式程序运行无误,构建正式程序后运行出错:terminnal运行app后报错信息importError: dlopen(/Users/Rachel1900/myproject/code/code_to_be_packed/pic2txt/dist/pic2txt_1.0.app/Contents/Resources/lib/python3.8/lib-dynload/PIL/_imaging.so, 2): Library not loaded:

2020-11-24 14:59:51 2321

原创 py2app-报错-ModuleNotFoundError: No module named ‘Image‘ &dlopen():Library not loaded: @loader_path/.d

报错原因查找使用py2app打os 应用程序,测试模式程序运行无误,构建正式程序后运行出错:查看控制台没找到具体报错原因,进入app所在路径$ cd /Users/Rachel1900/myproject/code/code_to_be_packed/pic2txt通过以下命令在terminnal中运行打包后的程序./dist/pic2txt.app/Contents/MacOS/pic2txt运行后报错,具体报错如下:RacheldeMacBook-Pro:pic2txt Rach

2020-11-24 14:59:16 1065 2

原创 【解决】py2app- 打包程序时“encounter a fatal error“

打包程序后运行测试版时遇到报错(base) RacheldeMacBook-Pro:code_to_be_packed Rachel1900$ ./dist/pic2txt.app/Contents/MacOS/pic2txt2020-11-23 10:32:00.222 pic2txt[14294:919233] A Python runtime not could be located. You may need to install a framework build of Python, or

2020-11-23 10:43:42 1331 1

原创 tkinter-bug-TclError: bad text index “0“

def img_2_text(): T.delete(0,END) #clear previous contents in Text报错:TclError: bad text index "0"原因:对于Text widget 0 为无效index ,应该改为10 is an invalid index for a text widget. In a text widget, you need to use ‘1.0’ instead of ‘0’. – Korzak Mar

2020-11-23 10:05:01 4807

翻译 tkinter-protocol-创建销毁窗口

WM_DELETE_WINDOW除事件绑定外,Tkinter还支持一种称为协议(protocol-)处理程序的机制。 协议是指应用程序与窗口管理器之间的交互。 最常用的协议称为WM_DELETE_WINDOW用于定义当用户使用窗口管理器显式关闭窗口时发生的情况。可以使用协议方法来为此协议安装处理程序(小部件必须是根或顶级插件):widget.protocol("WM_DELETE_WINDOW", handler)一旦定义了自己的处理程序handler,Tkinter将不再自动关闭窗口。 相反,

2020-11-22 18:48:30 9617

原创 tkinter-获取输入的信息-Entry/Listbox

错误示范:from tkinter import *root = Tk()e= Entry(root)e.pack()entry = e.get()root.mainloop()print("Entered text:"+entry)返回:Entered text:问题:使用get()时返回空值原因:Your eventual second problem is that the text would anyhow be printed only after the main

2020-11-22 15:18:40 7164

原创 tkinter-使用文件打开窗口提取选中文件的绝对路径

原代码:import tkinter as tkfrom tkinter import filedialogroot=Tk()root.title="test return of file_open"#file_open()a=tk.filedialog.askopenfile(mode="r")运行后跳转至文件打开对话框,任意选取文件后,返回值a,用print、type获取a的内容和类别print(a)<_io.TextIOWrapper name='/Users/Rachel

2020-11-22 11:21:22 1431

原创 tkinter- 报错-AttributeError: type object ‘Image‘ has no attribute ‘open‘

AttributeError: type object 'Image' has no attribute 'open'原因分析:引用顺序出错原try: from PIL import Imageexcept ImportError: import Imageimport osimport pytesseractfrom PIL import Imageimport tkinter as tkfrom tkinter import *from tkinter impor

2020-11-22 11:04:53 11411 6

原创 [pydeepl]使用deepl 翻译API

pydeeplDEEPL安装pip3 install pydeeplimport pydeeplimport OCR_with_tessercatdef language_setting(): promt="请输入目标语言\n" promt+="Deutsch: DE\nEnglish:EN\nFrench:FR\n" text= image_to_text() to_language = input(promt).upper() tran

2020-11-18 14:32:53 6953 4

空空如也

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

TA关注的人

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