2020年2月19日星期三

Python PIP Install throws TypeError: unsupported operand type(s) for -=: 'Retry' and 'int'

参考 https://stackoverflow.com/questions/37495375/python-pip-install-throws-typeerror-unsupported-operand-types-for-retry/46970344#46970344

apt-get remove python-pip python3-pip
wget https://bootstrap.pypa.io/get-pip.py
python get-pip.py
python3 get-pip.py

如果运行get-pip.py很慢,修改文件中的args = ["install", "--upgrade", "--force-reinstall", "-i", "https://pypi.douban.com/simple"] + args,新增了pip源即可。

2020年1月13日星期一

bazel 2.0.0新版本问题

更新了最新的bazel,报错:
name 'maven_server' is not defined
name 'maven_jar' is not defined

新版本不支持这些了,需要切换到旧版本的bazel,参考:https://github.com/google/mediapipe/issues/337

mac系统如何降级bazel,参考https://github.com/bazelbuild/homebrew-tap/issues/39

2019年12月20日星期五

统计文件夹中所有wav的时长

ls | xargs -i sox {} -n stat 2>&1 | grep Length | awk '{print $3}' | awk '{sum+=$1} END {print sum}'

2019年12月13日星期五

大量http连接TIME_WAIT

netstat -alntp | grep 38080,发现大量的TIME_WAIT,不确定是否正常。

参考了https://cloud.tencent.com/developer/article/1038071,修改/etc/sysctl.conf,增加三行:
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 1

/sbin/sysctl -p 使配置生效。

不确定是否能解决问题,待观察。

2019年11月27日星期三

pip install openpyxl问题解决

使用python2安装openpyxl时一直遇到一个问题:
Collecting openpyxl
  Using cached https://files.pythonhosted.org/packages/f4/5f/fb8706fba43b46716e252fdd3ffdfe801a63a0f4663b80b6f3421d85ab70/openpyxl-3.0.2.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-qUECOe/openpyxl/setup.py", line 28, in <module>
        from importlib.util import module_from_spec, spec_from_file_location
    ImportError: No module named util

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-qUECOe/openpyxl/

发现装3.x版本都不行,pip install pip install openpyxl==2.6.4,换成旧版本之后,解决问题。

2019年11月20日星期三

修改brew update镜像源

替换brew.git:
cd "$(brew --repo)"
git remote set-url origin https://mirrors.ustc.edu.cn/brew.git

替换homebrew-core.git:
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git