python - 如何使用 pip3 安装如果我已经有包裹,则离线
问题描述
我可以安装一个本地包,如下所示:
....,root,root # /usr/bin/pip3 install PyYAML-5.3.tar.gz
WARNING: Running pip install with root privileges is generally not a good idea. Try `pip3 install --user` instead.
Processing ./PyYAML-5.3.tar.gz
Installing collected packages: PyYAML
Found existing installation: PyYAML 3.13
Uninstalling PyYAML-3.13:
Successfully uninstalled PyYAML-3.13
Running setup.py install for PyYAML ... done
Successfully installed PyYAML-5.3
....,root,root #
但是如果我尝试下面的命令它会失败,因为它会在互联网上搜索(我的虚拟机没有互联网连接)
,root,root # /usr/bin/pip3 install PyYAML==5.3
WARNING: Running pip install with root privileges is generally not a good idea. Try `pip3 install --user` instead.
Collecting PyYAML==5.3
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f17164e0080>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',)': /simple/pyyaml/
Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f17164e0198>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',)': /simple/pyyaml/
Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f17164e0278>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',)': /simple/pyyaml/
Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f17164e0358>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',)': /simple/pyyaml/
Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f17164e0400>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',)': /simple/pyyaml/
Could not find a version that satisfies the requirement PyYAML==5.3 (from versions: )
No matching distribution found for PyYAML==5.3
.....,root,root #
所以问题是将我下载的包“PyYAML-5.3.tar.gz”放在默认位置以使此命令(/usr/bin/pip3 install PyYAML==5.3)在本地而不是在互联网上查找它?
解决方案
推荐阅读
- database - Clarification on First Normal Form
- c++ - !heap -l 的巨大差异导致调试和发布版本之间的 Windbg
- angular - 区分 Observables、Subjects、ReplaySubjects、Behavior Subjects?
- algorithm - 到达目的地的最短停留时间
- php - 将登录会话用户名/用户 ID 存储在本地存储中,然后在页面之间传递它是否安全?
- r - 给定数据框中的这两列,如何在 R 中使用“最小”函数?
- java - 在一个线程中定期发送许多 UDP 数据报有时会导致微包突发
- kotlin - Kotlin:使用 buildString 修复重载解析歧义
- python - 从标签中的条目中添加并获取浮点数的总和
- angular - 在库中具有延迟加载路由配置的 Angular CLI 项目