使用Pip在离线环境安装Python依赖库 |
您所在的位置:网站首页 › pip安装wheel › 使用Pip在离线环境安装Python依赖库 |
一、安装多个包
1.有网的服务器
1.生成requirement.txt文件
pip freeze >/tmp/wheel_pip/requirements.txt
这个命令会把当前环境下面的pip安装包名,都放到文件中 2.打包pip和wheel的whl文件 pip wheel --wheel-dir=/tmp/wheel_pip pip pip wheel --wheel-dir=/tmp/wheel_pip wheel如果没有wheel,就pip install wheel安装 3. 打包所有依赖包的whl文件 pip wheel --wheel-dir=/tmp/wheel_pip -r requirements.txt 4.下载get-pip文件 wget https://bootstrap.pypa.io/get-pip.py 5. 添加到压缩包 tar cf /tmp/wheel_pip wheel_pip.tar 2.离线的服务器 1.解压压缩包把wheel_pip.tar复制到离线的服务器,解压 cd /tmp/ & tar xf wheel_pip.tar ./ 2. 安装pip python get-pip.py --no-index --find-links=/tmp/wheel_pip 3. 安装wheel pip install --no-index --find-links=/tmp/wheel_pip wheel 4. 安装其他包 pip install --no-index --find-links=/tmp/wheel_pip -r requirements.txt pip install --no-index --find-links=/data1/upload/wheel_pip -r /data1/upload/wheel_pip/requirements.txt 三、安装单个包 1.有网的服务器打包 pip wheel --wheel-dir=/data1/anchor/lujianxing/ celery #指定包的版本 pip wheel --wheel-dir=/data1/anchor/lujianxing/ celery==3.1.18wheel包的地址 ll /data1/anchor/lujianxing/celery-3.1.18-py2.py3-none-any.whl 2.同步文件到正式环境 3. 无网的服务器安装 cd /data1/upload/ pip install celery-3.1.18-py2.py3-none-any.whl未经许可,请不要转载。 参考 |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |