解决configure: error: sys/capability.h...
网上都是centos的解决办法:
yum install libcap-devel
基本没有网站提及ubuntu怎么办。 ubuntu的安装方法如下:
apt-get install libcap-dev
ubuntu使用apt安装libuv
网上的教程都是编译安装,不用那么麻烦,用apt就可以直接安装。
apt-get install libuv1*
解决pyinstaller打包时报错:lib not found的问题
错误信息:
27625 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of c:\users\zwk\appdata\local\programs\python\python37\DLLs_ssl.pyd
28438 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of c:\users\zwk\appdata\local\programs\python\python37\DLLs_ssl.pyd
29257 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of c:\users\zwk\appdata\local\programs\python\python37\DLLs_ssl.pyd
解决办法:
pyinstaller -p C:\Windows\System32\downlevel mdtowordpress.py
hexo博客文章导入wordpress并保持格式及代码高亮
最近花了点时间从hexo把博客迁回了wordpress,遇到的问题是文章失去了格式和代码高亮,所以有了这个脚本。 该脚本可以将hexo的markdown高亮格式转换为wordpress的html格式并写入。 除了文章,其他内容也可以用该脚本获取并插入wordpress。
import re
import pymysql
import os
#获取所有hexo文件名并写入一个list
path = "C:\\Users\\baoli\\Desktop\\python" #hexo文件目录
filenames = os.listdir(path)
def add_escape(value): #给mysql无法直接插入的符号添加转移字符
reserved_chars = r'''\"\''''
replace = ['\\' + l for l in reserved_chars]
trans = str.maketrans(dict(zip(reserved_chars, replace)))
return value.translate(trans)
for file in filenames:
result=[] #未处理list
num=0 #判断特殊字符奇偶
cut=[] #处理完成包含文章标题和内容的list
file = open('python\\'+file, "rb")
lines = file.readlines()
for item in lines:
if (item.decode().startswith('-')) is True: #逐行读取,如果是以 - 开头就跳过不处理
continue
else:
if (item.decode().startswith('title')) is True: #如果以title开头匹配出文章标题
...
linux新建用户登录后终端只有一个$问题解决
解决方法是将默认的shell改为bash:
root@ubuntu:~# vi /etc/passwd
将对应用户最后的/bin/sh改为/bin/bash:
jiang:x:1003:1003::/usr/jiang:/bin/bash
python2.7 pip默认不支持ssl解决
通过添加--trusted-host参数解决,使用类似如下命令:
pip install --trusted-host pypi.tuna.tsinghua.edu.cn opencv-python -i https://pypi.tuna.tsinghua.edu.cn/simple some-package