(离线安装)通过pip将python包和其依赖全部打包
原文链接:blog.csdn.net/...
pip下载命令
pip download -d save_path packages
-d:后面接下载包路径(save_path) packages:安装包名称
例如:本人想下载py2neo这个包,且保存在neo4j文件夹里面
pip download -d neo4j py2neo
步骤一
1.1 下载过程
(SPO) ubuntu@AZ:/mnt/01CodeFiles/KnowledgeGraph/$ pip download -d ./neo4j py2neo
Looking in indexes: https://pypi.org/simple, https://pypi.ngc.nvidia.com
Collecting py2neo
Downloading py2neo-2021.2.4-py2.py3-none-any.whl (177 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 177.2/177.2 kB 714.8 kB/s eta 0:00:00
Collecting interchange~=2021.0.4
Downloading interchange-2021.0.4-py2.py3-none-any.whl (28 kB)
Collecting pygments>=2.0.0
Downloading pygments-2.17.2-py3-none-any.whl (1.2 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.2/1.2 MB 4.6 MB/s eta 0:00:00
Collecting pansi>=2020.7.3
Downloading pansi-2020.7.3-py2.py3-none-any.whl (10 kB)
Collecting six>=1.15.0
Downloading six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting packaging
Downloading packaging-24.0-py3-none-any.whl (53 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 53.5/53.5 kB 90.3 MB/s eta 0:00:00
Collecting monotonic
Downloading monotonic-1.6-py2.py3-none-any.whl (8.2 kB)
Collecting urllib3
Downloading urllib3-2.2.1-py3-none-any.whl (121 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 121.1/121.1 kB 117.1 MB/s eta 0:00:00
Collecting certifi
Downloading certifi-2024.2.2-py3-none-any.whl (163 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 163.8/163.8 kB 123.7 MB/s eta 0:00:00
Collecting pytz
Downloading pytz-2024.1-py2.py3-none-any.whl (505 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 505.5/505.5 kB 21.1 MB/s eta 0:00:00
Saved ./neo4j/py2neo-2021.2.4-py2.py3-none-any.whl
Saved ./neo4j/interchange-2021.0.4-py2.py3-none-any.whl
Saved ./neo4j/pansi-2020.7.3-py2.py3-none-any.whl
Saved ./neo4j/pygments-2.17.2-py3-none-any.whl
Saved ./neo4j/six-1.16.0-py2.py3-none-any.whl
Saved ./neo4j/certifi-2024.2.2-py3-none-any.whl
Saved ./neo4j/monotonic-1.6-py2.py3-none-any.whl
Saved ./neo4j/packaging-24.0-py3-none-any.whl
Saved ./neo4j/urllib3-2.2.1-py3-none-any.whl
Saved ./neo4j/pytz-2024.1-py2.py3-none-any.whl
Successfully downloaded py2neo interchange pansi pygments six certifi monotonic packaging urllib3 pytz
1.2下载文件详情
neo4j
certifi-2024.2.2-py3-none-any.whl
interchange-2021.0.4-py2.py3-none-any.whl
monotonic-1.6-py2.py3-none-any.whl
packaging-24.0-py3-none-any.whl
pansi-2020.7.3-py2.py3-none-any.whl
py2neo-2021.2.4-py2.py3-none-any.whl
pygments-2.17.2-py3-none-any.whl
pytz-2024.1-py2.py3-none-any.whl
six-1.16.0-py2.py3-none-any.whl
urllib3-2.2.1-py3-none-any.whl
步骤二
2.1 创建并补充requirement.txt中的内容
本文下载的是py2neo离线宝和其依赖包,根据自己离线下载的包进行调整
规则: requirement.txt里内容按照终端下载安装包的顺序从下往上写入名称 ,如下 txt文档的安装包名称写入顺序和终端下载顺序是相反的
pytz-2024.1-py2.py3-none-any.whl
certifi-2024.2.2-py3-none-any.whl
urllib3-2.2.1-py3-none-any.whl
monotonic-1.6-py2.py3-none-any.whl
packaging-24.0-py3-none-any.whl
six-1.16.0-py2.py3-none-any.whl
pansi-2020.7.3-py2.py3-none-any.whl
pygments-2.17.2-py3-none-any.whl
interchange-2021.0.4-py2.py3-none-any.whl
py2neo-2021.2.4-py2.py3-none-any.whl
文件夹内容如下,本文下载的是 py2neo 离线宝和其依赖包
neo4j
certifi-2024.2.2-py3-none-any.whl
interchange-2021.0.4-py2.py3-none-any.whl
monotonic-1.6-py2.py3-none-any.whl
packaging-24.0-py3-none-any.whl
pansi-2020.7.3-py2.py3-none-any.whl
py2neo-2021.2.4-py2.py3-none-any.whl
pygments-2.17.2-py3-none-any.whl
pytz-2024.1-py2.py3-none-any.whl
requirement.txt
six-1.16.0-py2.py3-none-any.whl
urllib3-2.2.1-py3-none-any.whl
2.2 离线安装安装包
终端进入demo文件夹目录路径,输入下面命令:
sudo pip install -r requirements.txt
安装过程如下,每个人情况略有不同
转载自:https://juejin.cn/post/7360629255259553803