将模块下载到本地文件夹后如何在没有pip的情况下安装python模块 [英] how to install python module without pip after we download the module to local folder

查看:48
本文介绍了将模块下载到本地文件夹后如何在没有pip的情况下安装python模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们可以下载模块 - requests ,如下

we can download the module - requests , as the following

cd /home/module/
pip download requests
ls -l
certifi-2019.9.11-py2.py3-none-any.whl  chardet-3.0.4-py2.py3-none-any.whl  idna-2.8-py2.py3-none-any.whl  requests-2.22.0-py2.py3-none-any.whl  urllib3-1.25.6-py2.py3-none-any.whl

现在我们可以轻松地将模块安装为

now we can easily to install the module as

pip install *.whl

我们可以通过

python -c "import requests"

现在 - 因为在一些 Linux redhat 机器上我们没有 pip(因为安全原因我们不能安装 pip)

now - since on some Linux redhat machines we not have pip ( we cant install pip because security reasons )

所以我们想安装没有pip的模块

我们尝试

 easy_install --install-dir=/home/module/*

但是我们得到了错误,也许我没有正确使用它,

but we get errors , maybe I not use it right ,

那么我们可以得到建议,如何从本地文件夹中安装没有 pip 的请求模块吗?

so can we get advice how to install the requests module without pip from local folder ?

推荐答案

您可以从源代码安装模块:

You could install the module from source:

foo@bar:~/$ git clone https://github.com/psf/requests.git
foo@bar:~/$ cd requests
foo@bar:~/requests$ git checkout v2.22.0
foo@bar:~/requests$ python setup.py install

这篇关于将模块下载到本地文件夹后如何在没有pip的情况下安装python模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆