pip download制作离线安装
由于公司的服务器处于与外网隔离的状态,安装第三方包比较麻烦,故写此文章,仅供参考。1. 在本机虚拟机(物理机)联网执行直接执行:pip download -d /home/pkgs tensorflow -i https://pypi.tuna.tsinghua.edu.cn/simple或者将需要安装的软件写入requirement.txt 执行pip download -d /home/pkg
·
由于公司的服务器处于与外网隔离的状态,安装第三方包比较麻烦,故写此文章,仅供参考。
1. 在本机虚拟机(物理机)联网执行
直接执行:pip download -d /home/pkgs tensorflow -i https://pypi.tuna.tsinghua.edu.cn/simple
或者将需要安装的软件写入requirement.txt
执行pip download -d /home/pkgs -r requirement.txt
以在公司服务器上安装tensorflow等开发环境为例(离线安装):
#!/usr/bin/bash
echo "下载前的准备..."
username="username"
cd /home/$usernme
mkdir -p /home/$usernme/pkgs
cat > requirement.txt <<"EOF"
tensorflow==2.2.0
scikit-image==0.15.0
scikit-learn==0.24.2
opencv-python==4.5.2.52
numpy
pandas
requests
flask
EOF
echo "下载中..."
pip download \
-d /home/$usernme/pkgs \
-r requirement.txt \
-i https://pypi.tuna.tsinghua.edu.cn/simple \
--proxy=http://192.168.110.111
echo "打包压缩文件..."
tar -zcvf tensorflow_and_other_file.tar.gz pkgs
二、离线安装
pip install --no-index --find-links=/home/pkgs tensorflow
pip install --no-index --find-links=/home/pkgs -r requirements.txt
更多推荐
已为社区贡献6条内容
所有评论(0)