简体   繁体   English

如何为python27安装请求库

[英]How to install request library for python27

I'm currently creating a project I'm python and I need to post to a http server.I tried using pip install requests but pip doesn't work on my computer. 我当前正在创建一个我是python的项目,我需要发布到http服务器。我尝试使用pip安装请求,但pip在我的计算机上不起作用。

Pls how do I get the request library because it is not present in my python default libraries. 请问我如何获取请求库,因为它在我的python默认库中不存在。 Please I need something like a link or a website 请我需要链接或网站之类的东西

where I can download and successfully install request library for python27.Thanks 在这里我可以下载并成功安装python27的请求库。

If you go to PyPI.org and look up a package there, it will have a bunch of "Navigation" and "Project Links" links on the left side. 如果您转到PyPI.org并在那里查找软件包,则它将在左侧具有一堆“导航”和“项目链接”链接。

Start with Homepage if present. 从首页开始(如果存在)。 In the case of Requests, "Homepage" will take you to documentation where, right at the top, there's a link that says "Release v2.18.4 (Installation)". 对于请求, “主页”将带您到文档的顶部,该文档的顶部有一个链接,显示“发布v2.18.4(安装)”。 Click on that, and it'll tell you how to download and install from source. 单击该按钮,它将告诉您如何从源代码下载和安装。

If you can't find that for some package, try "Download" next, which will hopefully have nice friendly download links. 如果找不到某个软件包,请尝试下一个“下载”,希望它会提供友好的下载链接。

Failing that, click on "Download files", and you should get a table containing at least one entry of type "Source", with a link to a source tarball (or zipfile). 失败的话,单击“下载文件”,您应该得到一个包含至少一个类型为“源”的条目的表,并带有指向源tarball(或zipfile)的链接。

If you've found directions to install from source, great. 如果您找到了从源代码安装的说明,那就太好了。 If not, unpack the archive and scan through it trying to find an INSTALL or README or other doc that tells you have to install it. 如果没有,请解压缩存档并进行扫描,以查找INSTALLREADME或其他文档,告诉您必须安装它。

Most current packages with up-to-date documentation are going to tell you to install the source (maybe after a manual build step) with pip install . 当前包含最新文档的软件包会告诉您使用pip install .源(可能是在手动构建步骤之后) pip install . (with or without sudo ). (有或没有sudo )。 If you really can't use pip at all for some strange reason, usually you'll be OK doing this instead (again, with or without sudo ): 如果由于某种奇怪的原因而真的不能使用pip ,通常您可以这样做(同样可以使用sudo或不使用sudo ):

python setup.py install

However, you will often need to manually download and install some prerequisites. 但是,您通常需要手动下载并安装一些先决条件。 Look for a requirements.txt file, and recursively download and install each thing on that list, then come back to this package. 查找requirements.txt文件,然后递归下载并安装该列表中的所有内容,然后返回此软件包。

Finally, at the end of all of this, you won't have any good record of what you installed, what versions you had, which packages were dependencies of other packages, etc. Upgrading to new versions, or migrating your environment to a different machine, will be a nightmare. 最后,在所有这些操作的最后,您将没有任何关于安装内容,安装的版本,哪些软件包是其他软件包的依赖项等的良好记录。升级到新版本,或将环境迁移到其他版本机器,将是一场噩梦。 And so on. 等等。 All the stuff pip does for you, you don't get if you don't use pip . pip为您提供的所有东西,如果不使用pip ,您将pip But if you really want to do it all manually, you can. 但是,如果您真的想手动完成所有操作,则可以。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM