Python 车轮文件安装

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/28002897/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 02:35:37  来源:igfitidea点击:

Wheel file installation

pythoninstallpython-wheel

提问by balloneij

How do I install a .whl file? I have the Wheel library but I don't know how to use it to install those files. I have the .whl file but I don't know how to run it. Please help.

如何安装 .whl 文件?我有 Wheel 库,但我不知道如何使用它来安装这些文件。我有 .whl 文件,但我不知道如何运行它。请帮忙。

采纳答案by Martijn Pieters

You normally use a tool like pipto install wheels. Leave it to the tool to discover and download the file if this is for a project hosted on PyPI.

您通常使用诸如pip安装轮子之类的工具。如果这是用于 PyPI 上托管的项目,则将其留给工具来发现和下载文件。

For this to work, you do need to install the wheelpackage:

为此,您需要安装wheel软件包:

pip install wheel

You can then tell pipto install the project (and it'll download the wheel if available), or the wheel file directly:

然后,您可以告诉pip安装项目(如果可用,它将下载轮子)或直接安装轮子文件:

pip install project_name  # discover, download and install
pip install wheel_file.whl  # directly install the wheel

The wheelmodule, once installed, also is runnable from the command line, you can use this to install already-downloaded wheels:

wheel模块一旦安装,也可以从命令行运行,您可以使用它来安装已经下载的轮子:

python -m wheel install wheel_file.whl

Also see the wheelproject documentation.

另请参阅wheel项目文档

回答by Sam_Sadana

If you already have a wheel file (.whl) on your pc, then just go with the following code:

如果您的电脑上已经有一个轮文件 (.whl),那么只需使用以下代码:

cd ../user
pip install file.whl

If you want to download a file from web, and then install it, go with the following in command line:

如果要从 Web 下载文件,然后安装它,请在命令行中执行以下操作:

pip install package_name

or, if you have the url:

或者,如果您有网址:

pip install http//websiteurl.com/filename.whl

This will for sure install the required file.

这肯定会安装所需的文件。

Note: I had to type pip2 instead of pip while using Python 2.

注意:在使用 Python 2 时,我必须输入 pip2 而不是 pip。