我的Python是2.7.5,
-bash-4.2$ python --version
Python 2.7.5
默认情况下它没有 python pip。
我的 Linux 是 Redhat ERHL 7.3。
-bash-4.2$ cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.3 (Maipo)
我还检查了 Linux 存储库中没有 python-pip 。
-bash-4.2$ yum search python-pip
Loaded plugins: product-id, rhnplugin, search-disabled-repos, subscription-manager
*Note* Spacewalk repositories are not listed below. You must run this command as root to access Spacewalk repositories.
cloudera-manager 7/7
Warning: No matches found for: python-pip
No matches found
我安装 pip 的方法是使用get-pip.py
.我得到了get-pip.py
来自https://packaging.python.org/installing/
下载链接是https://bootstrap.pypa.io/get-pip.py
我为我的 Windows 笔记本电脑下载了它,然后通过 ftp 将其上传到 Linux 服务器。
当我跑的时候python get-pip.py
。它尝试连接到互联网。
-bash-4.2$ python get-pip.py
Collecting pip
Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x35755d0>: Failed to establish a new connection: [Errno 101] Network is unreachable',)': /simple/pip/
Retrying (Retry(total=3, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x3575a90>: Failed to establish a new connection: [Errno 101] Network is unreachable',)': /simple/pip/
问题:
- 它连接到哪里?
- 我可以设置私人存储库吗?
- 是 pypi 仓库吗?
- 我可以为此 pypi 存储库使用静态 Web 服务器吗?
- 如何设置 get-pip.py 将连接指向我的私人存储库?
答案1
如果您不想采用操作系统方式,您还可以从 PyPI 下载源存档并手动安装。
- 去https://pypi.org/project/pip/#files
- 下载并解压存档文件。
- 跑步
python setup.py install