pip和 conda py包下载到本地再离线安装
# pip把wheel下载到本地
## https://pip.pypa.io/en/stable/cli/pip_download/ cd /home/xx/wheels python3.7 -m pip download h5py -d ./ -i https://pypi.tuna.tsinghua.edu.cn/simple
python3.7 -m pip download h5py -d ./ -i https://pypi.tuna.tsinghua.edu.cn/simple -platform manylinux1_x86_64 --platform linux_x86_64
# conda把 包 下载到本地, 不安装, 下载路径: xx/anaconda3/pkgs/xx.tar.bz2
# conda rep url: https://anaconda.org/search?q=libprotobuf conda install kornia --download-only # pip 强制安装本地包 python3.7 -m pip install ./xxx.whl --no-index --find-links=./ # pip 安装方法2,使用py脚本来自动读取安装
""" python3.7 install_whl.py """ import os if __name__ == '__main__': _path = './1' _cmd = 'python3.7 -m pip install ./1/@ --no-index --find-links=./1' for whl in os.listdir(_path): _cmd1 = _cmd.replace('@', whl) os.system(_cmd1)
# conda 安装本地包 conda install --use-lcoal ./xxx.tar.bz2