博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
如何在Windows上安装和使用curl?
阅读量:2381 次
发布时间:2019-05-10

本文共 7181 字,大约阅读时间需要 23 分钟。

本文翻译自:

I am having trouble getting curl to run on Windows. 我无法在Windows上运行curl。

I have downloaded a curl zip file from , but it seems to contain source code, not an executable. 我从下载了一个curl zip文件,但它似乎包含源代码,而不是可执行文件。

Do I need to compile curl to run it? 是否需要编译curl才能运行它? If yes, then how do I do that? 如果是,那我该怎么做?

Where can I find .exe downloads for curl? 我在哪里可以找到curl的.exe下载?

I have looked for documentation on installing curl, but there is little to be found. 我已经查找了有关安装curl的文档,但几乎没有找到。


#1楼

参考:


#2楼

You might already have curl 你可能已经卷曲了

It is possible that you won't need to download anything: 你可能不需要下载任何东西:

  • If you are on Windows 10, version 1803 or later, your OS , already set up and ready to use. 如果您使用的是Windows 10,版本1803或更高版本,则您的操作系统会已经设置好并可以使用。
  • If you have installed (if you downloaded Git from , the answer is yes), you have curl.exe under: 如果你安装了 (如果你从下载了Git,答案是肯定的),你有curl.exe

    C:\\Program Files\\Git\\mingw64\\bin\\

    Simply add the above path to PATH . 只需将上述路径添加到PATH

Installing curl with a package manager 使用包管理器安装curl

If you are already using a package manager, it may be more convenient to install with one: 如果您已经在使用软件包管理器,则安装一个软件包可能更方便:

  • For , run choco install curl 对于 ,运行choco install curl
  • For , run pacman -S curl 对于 ,运行pacman -S curl
  • For , run scoop install curl 对于 ,运行scoop install curl
  • For , . 对于 , 。

Installing curl manually 手动安装卷曲

Downloading curl 下载卷曲

It is too easy to accidentally download the wrong thing. 很容易意外地下载错误的东西。 If, on the , you click the large and prominent "Download" section in the site header, and then the large and prominent curl-7.62.0.tar.gz link in its body, you will have downloaded a curl source package , which contains curl's source code but not curl.exe . 如果在单击网站标题中较大且突出的“下载”部分,然后curl-7.62.0.tar.gz其主体中的大而突出的curl-7.62.0.tar.gz链接,您将下载一个卷曲源包 ,其中包含curl的源代码但不包含curl.exe Watch out for that. 注意这一点。

Instead, click the large and prominent download links . 而是单击的大而重要的下载链接。 Those are the official Windows builds, and they are provided by the project. 这些是官方的Windows版本,它们由项目提供。

If you have more esoteric needs (eg you want cygwin builds, third-party builds, libcurl, header files, sources, etc.), use the curl . 如果您有更多深奥的需求(例如,您需要cygwin构建,第三方构建,libcurl,头文件,源等),请使用curl 。 After answering five questions, you will be presented with a list of download links. 回答完五个问题后,您将看到一个下载链接列表。

Extracting and setting up curl 提取和设置卷曲

Find curl.exe within your downloaded package; 在下载的包中找到curl.exe ; it's probably under bin\\ . 它可能在bin\\

Pick a location on your hard drive that will serve as a permanent home for curl: 选择硬盘上的一个位置,作为卷曲的永久主页:

  • If you want to give curl its own folder, C:\\Program Files\\curl\\ or C:\\curl\\ will do. 如果你想给curl一个自己的文件夹, C:\\Program Files\\curl\\C:\\curl\\会这样做。
  • If you have many loose executables, and you do not want to add many individual folders to PATH , use a single folder such as C:\\Program Files\\tools\\ or C:\\tools\\ for the purpose. 如果您有许多松散的可执行文件,并且您不想将许多单个文件夹添加到PATH ,请使用单个文件夹,例如C:\\Program Files\\tools\\C:\\tools\\

Place curl.exe under the folder. curl.exe放在该文件夹下。 And never move the folder or its contents. 永远不要移动文件夹或其内容。

Next, you'll want to make curl available anywhere from the command line. 接下来,您将希望在命令行的任何位置都可以使用curl。 To do this, add the folder to PATH , like this: 为此,请将文件夹添加到PATH ,如下所示:

  1. Click the Windows 10 start menu. 单击Windows 10开始菜单。 Start typing "environment". 开始输入“环境”。
  2. You'll see the search result Edit the system environment variables . 您将看到搜索结果编辑系统环境变量 Choose it. 选择它。
  3. A System Properties window will popup. 将弹出“系统属性”窗口。 Click the Environment Variables button at the bottom. 单击底部的“ 环境变量”按钮。
  4. Select the "Path" variable under "System variables" (the lower box). 在“系统变量”(下部框)下选择“路径”变量。 Click the Edit button. 单击“ 编辑”按钮。
  5. Click the Add button and paste in the folder path where curl.exe lives. 单击“ 添加”按钮并粘贴curl.exe所在的文件夹路径。
  6. Click OK as needed. 根据需要单击确定 Close open console windows and reopen, so they get the new PATH . 关闭打开的控制台窗口并重新打开,这样他们就可以获得新的PATH

Now enjoy typing curl at any command prompt. 现在喜欢在任何命令提示符下键入curl。 Party time! 晚会时间!


#3楼

You can build the latest version of curl, openssl, libssh2 and zlib in 3 simple steps by following 按照 ,您可以通过3个简单步骤构建最新版本的curl,openssl,libssh2和zlib

Curl is built statically so you do not have to distribute the prerequisite dynamic runtime. Curl是静态构建的,因此您不必分发必备动态运行时。

You can also download a prebuilt version (x86 and x64) from 您还可以从下载预构建版本(x86和x64)


#4楼

The simplest tutorial for setting up cURL on Windows is the . Windows上设置cURL的最简单的教程是 It only have 3 easy steps . 它只有3个简单的步骤


#5楼

As you already know, you can find several packages of binaries on the official curl website. 如您所知,您可以在官方卷曲网站上找到几个二进制包。

Once you download a package, unzip it wherever you want. 下载软件包后,将其解压缩到任意位置。 I recommend adding its location to your path, so you can call curl from batch or powershell scripts. 我建议将其位置添加到路径中,这样您就可以从批处理或PowerShell脚本调用curl。 To add a directory to your path type "environment variables" in the start menu, and select "edit user environment variables". 要在路径中添加目录,请在开始菜单中键入“环境变量”,然后选择“编辑用户环境变量”。 Select Path, and add to the end of the "value" box: ;C:\\curl\\directory (with the directory changed to where you saved curl.) 选择Path,并添加到“value”框的末尾:; C:\\ curl \\ directory(将目录更改为保存curl的位置。)

If you want to use SSL you need a certificate bundle. 如果要使用SSL,则需要证书包。 Run either mk-ca-bundle.pl (perl) or mk-ca-bundle.vbs (VBScript). 运行mk-ca-bundle.pl(perl)或mk-ca-bundle.vbs(VBScript)。 Some of the packages of binaries include one or both of them. 一些二进制包包括其中一个或两个。 If your download doesn't include one, download one here: . 如果您的下载不包含,请在此处下载: : 。 I recommend mk-ca-bundle.vbs, as on windows you simply double click it to run it. 我推荐使用mk-ca-bundle.vbs,因为在Windows上只需双击它即可运行它。 It will produce a file called ca-bundle.crt. 它将生成一个名为ca-bundle.crt的文件。 Rename it curl-ca-bundle.crt and save it in the directory with curl.exe. 将其重命名为curl-ca-bundle.crt并将其保存在curl.exe目录中。

Alternatively, I recently developed an msi installer that sets up a full featured build of curl with just a few clicks. 或者,我最近开发了一个msi安装程序,只需点击几下即可设置完整的curl版本。 It automatically ads curl to your path, includes a ready-to-use ssl certificate bundle, and makes the curl manual and documentation accessible from the start menu. 它自动广告卷曲到您的路径,包括一个现成的ssl证书包,并使开始菜单中的卷曲手册和文档可访问。 You can download it at . 您可以在下载。


#6楼

  1. Download curl zip 下载curl zip
  2. Extract the contents (if you have downloaded the correct version you should find curl.exe) 解压缩内容(如果您下载了正确的版本,则应找到curl.exe)
  3. Place curl.exe in a folder where you keep your software (eg D:\\software\\curl\\curl.exe) 将curl.exe放在保存软件的文件夹中(例如D:\\ software \\ curl \\ curl.exe)
  4. To run curl from the command line 从命令行运行curl

    a) Right-hand-click on "My Computer" icon a)右键单击“我的电脑”图标

    b) Select Properties b)选择“属性”

    c) Click 'Advanced system settings' link c)单击“高级系统设置”链接

    d) Go to tab [Advanced] - 'Environment Variables' button d)转到选项卡[高级] - “环境变量”按钮

    e) Under System variable select 'Path' and Edit button e)在系统变量下,选择“路径”和“编辑”按钮

    f) Add a semicolon followed by the path to where you placed your curl.exe (eg ;D:\\software\\curl) f)添加一个分号,然后添加你放置curl.exe的路径(例如; D:\\ software \\ curl)

Now you can run from the command line by typing: 现在,您可以通过键入以下命令从命令行运行:

curl www.google.com

转载地址:http://duexb.baihongyu.com/

你可能感兴趣的文章
哪些领域的应用因为大数据变得更聪明?
查看>>
大数据驱动电信运营商转型
查看>>
玩转大数据 运动员如何用科技提升成绩
查看>>
广发银行试水大数据 “精细服务”现雏形
查看>>
大数据让社区生活更方便
查看>>
借助互联网大数据打假
查看>>
东信北邮大数据项目获2014中国通信学会科学技术一等奖
查看>>
大数据塑造新时代公共外交
查看>>
海-两篇
查看>>
整理硬盘
查看>>
ERP&SCM&MES發展歷程
查看>>
风-----
查看>>
系统Server架构图
查看>>
我的简历
查看>>
一种自适应的柔性制造系统优化调度算法
查看>>
现代管理思想与总图设计
查看>>
原创BPR之企业流程分析模型图 FDD
查看>>
PLM技术促进现代模具企业精益化和规模化
查看>>
独一无二的IFS CAD与PDM集成工具发布
查看>>
BPR-FDD 模型图原始档
查看>>