苹果为了保持自家一定领先地位,在 MAC 设备上都采用了 SSD 磁盘。为了帮助用户关注磁盘运行状况,macOS 系统中已经内置了检查内置 SSD 和其它已连接磁盘运行状态的相关工具。以便在SSD 固态磁盘挂掉之前,就让用户提前检测并知晓其工作状态。
各种存储介质,包括 SSD,其实都是消耗品。这意味着一旦磁盘挂了,不仅会影响系统正常运行,甚至存储的文件都会有损失的风险。
苹果为了保持自家一定领先地位,在 MAC 设备上都采用了 SSD 磁盘。为了帮助用户关注磁盘运行状况,macOS 系统中已经内置了检查内置 SSD 和其它已连接磁盘运行状态的相关工具。以便在SSD 固态磁盘挂掉之前,就让用户提前检测并知晓其工作状态。
各种存储介质,包括 SSD,其实都是消耗品。这意味着一旦磁盘挂了,不仅会影响系统正常运行,甚至存储的文件都会有损失的风险。
Github地址: https://github.com/Belval/TextRecognitionDataGenerator
官方文档:https://textrecognitiondatagenerator.readthedocs.io/en/latest/index.html
安装:
|
1 2 3 4 5 |
# pip 安装,中文不建议 $ pip install trdg -i https://pypi.mirrors.ustc.edu.cn/simple/ # git clone $ git clone https://github.com/Belval/TextRecognitionDataGenerator |
以下根据个人需要:
git clone 解压后进入 /trdg/bin 安装目录:
|
1 2 3 4 5 6 7 8 9 |
$ mv trdg ../run.py $ cd .. $ vim run.py # 删除 run.py中的 from trdg import, 全部改为 import $ vim data_generator.py # 同上,删除此文件首部的 from trdg import, 改为 import |
生成命令(示例,具体见官方文档):
|
1 |
$ python trdg -l cn -c 1000000 -d 1 -rs -b 3 -w 20 -bl 1 -rbl -tc '#000000,#888888' -f 64 -t 32 --output_dir 'sin-100w' |
Github地址:https://github.com/Sanster/text_renderer
参见 github 的 README.md.
Github地址: https://github.com/ankush-me/SynthText
python国内源
阿里云 https://mirrors.aliyun.com/pypi/simple/
中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
豆瓣(douban) http://pypi.douban.com/simple/
清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/
可以在使用pip的时候在后面加上-i参数,指定pip源为国内源
|
1 |
eg: pip install scrapy -i https://pypi.tuna.tsinghua.edu.cn/simple |
Linux/macOS:
修改 ~/.pip/pip.conf (没有就创建一个), 内容如下:
|
1 2 |
[global] index-url = https://pypi.tuna.tsinghua.edu.cn/simple |
对于当前用户不是root,而有时候需要使用sudo安装的情况,上述设置是无效的。需要在root用户目录也设置一下,一般情况下配置文件默认是/root/.pip/pip.conf。
Windows:
直接在user目录中创建一个pip目录,如:C:\Users\xx\pip,新建文件pip.ini,内容如下
|
1 2 |
[global] index-url = https://pypi.tuna.tsinghua.edu.cn/simple |
在 macOS 10.15.2下使用 tkinter 库 Entry 输入框,无法输入中文,不管怎么样都只能输入英文,只能复制进去中文,交互体验很不好ಥ_ಥ。
我的版本是 macOS 10.15.2,python 3.7.5。
安装最新版本的 CUDA 10.1:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# 卸载之前已经安装的cuda $ sudo apt-get remove nvidia-cuda-toolkit $ wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-ubuntu1804.pin $ sudo mv cuda-ubuntu1804.pin /etc/apt/preferences.d/cuda-repository-pin-600 $ wget http://developer.download.nvidia.com/compute/cuda/10.1/Prod/local_installers/cuda-repo-ubuntu1804-10-1-local-10.1.243-418.87.00_1.0-1_amd64.deb $ sudo dpkg -i cuda-repo-ubuntu1804-10-1-local-10.1.243-418.87.00_1.0-1_amd64.deb $ sudo apt-key add /var/cuda-repo-10-1-local-10.1.243-418.87.00/7fa2af80.pub $ sudo apt-get update $ sudo apt-get -y install cuda # 部分驱动可能会更新,需要执行更新,否则可能依旧不正常 $ sudo apt-get dist-upgrade $ sudo apt-get autoremove # 可能需要删除一下XWindow的配置文件,否则驱动可能不能正常加载 $ sudo rm -rf ~/.Xauthority # 如果出现如下错误 # ubuntu 18.04 "nvidia-340 导致 /usr/lib/x86_64-linux-gnu/libGL.so.1 # 转移到 /usr/lib/x86_64-linux-gnu/libGL.so.1.distrib" # 参考 http://www.mobibrw.com/?p=21739 # 删除安装源,可以节约几个GB的磁盘,安装完成后这部分已经用不上了 $ sudo apt-get remove --purge cuda-repo-ubuntu1804-10-1-local-10.1.243-418.87.00 |
安装对应版本的cuDNN:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
$ wget https://www.mobibrw.com/wp-content/uploads/2019/11/libcudnn7_7.6.5.32-1cuda10.1_amd64.deb_.zip $ wget https://www.mobibrw.com/wp-content/uploads/2019/11/libcudnn7-dev_7.6.5.32-1cuda10.1_amd64.deb_.zip $ wget https://www.mobibrw.com/wp-content/uploads/2019/11/libcudnn7-doc_7.6.5.32-1cuda10.1_amd64.deb_.zip # 解压缩 $ unzip libcudnn7_7.6.5.32-1cuda10.1_amd64.deb_.zip $ unzip libcudnn7-dev_7.6.5.32-1cuda10.1_amd64.deb_.zip $ unzip libcudnn7-doc_7.6.5.32-1cuda10.1_amd64.deb_.zip # 按照顺序安装 $ sudo dpkg -i libcudnn7_7.6.5.32-1+cuda10.1_amd64.deb $ sudo dpkg -i libcudnn7-dev_7.6.5.32-1+cuda10.1_amd64.deb $ sudo dpkg -i libcudnn7-doc_7.6.5.32-1+cuda10.1_amd64.deb |
检测是否成功安装:
|
1 2 3 4 5 6 7 |
$ cp -r /usr/src/cudnn_samples_v7/ ~/ $ cd ~/cudnn_samples_v7/mnistCUDNN $ make clean && make $ ./mnistCUDNN |
执行输出如下结果代表成功安装:
前提:代码中设置了arg paser,需要手动设置,VS code的debug没有简洁的添加参数的方式。
解决方式如下:
打开Debug->Open Configurations/ Add Configurations
|
1 2 3 4 5 |
# Python2 $ pip install requests-html # Python3 # pip3 install requests-html |
即可安装该模块。
例子如下:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
#coding=utf-8 from bs4 import BeautifulSoup import requests from requests_html import HTMLSession #使用requests抓取页面内容,并将响应赋值给page变量 html = requests.get('https://xcx.xzlzq.net/#/liftDetail?registerCode=31103301042010020002') session = HTMLSession() first_page = session.get('https://xcx.xzlzq.net/#/liftDetail?registerCode=31103301042010020002') first_page.html.render(sleep=5) #使用content属性获取页面的源页面 #使用BeautifulSoap解析,内容传递到BeautifulSoap类 soup = BeautifulSoup(first_page.html.html,'lxml') links = soup.find_all('div',class_='content') #link的内容就是div,我们取它的span内容就是我们需要段子的内容 for link in links: print(link.span.get_text()) |
最近的三星固态硬盘提示固件有升级,但是固件升级失败,提示“在选定的驱动器上无法更新固件。”或者"Failed to update firmware on the selected drive."
如下图所示:
继续阅读Samsung Magician 6.0升级固件失败“在选定的驱动器上无法更新固件。”("Failed to update firmware on the selected drive.")
开发 Vulkan 的时候,需要使用 glslangValidator 编译 Vulkan 代码。
如果是 ubuntu 19.10 版本,可以直接执行:
|
1 2 3 |
$ sudo apt-get install vulkan-tools # 目前ubuntu 20.04 最新需要使用如下命令 sudo apt-get install glslang-tools |
如果低于这个版本,则只能从源代码编译安装了,如下:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# 编译安装 glslang $ git clone https://github.com/KhronosGroup/glslang.git # 也可本站下载一份拷贝 wget https://www.mobibrw.com/wp-content/uploads/2018/12/glslang.zip $ cd glslang # 目前(2018.12.17)的正式版,最稳定的版本,试过最新的版本,编译部分代码存在问题 $ git checkout 7.10.2984 # 下载 spirv-tools 部分的功能代码 $ python update_glslang_sources.py $ mkdir build $ cd build $ cmake .. $ make $ sudo make install |