车轮文件安装

问题:车轮文件安装

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

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.


回答 0

通常,您会使用pip安装车轮之类的工具。如果这是针对PyPI上托管的项目的,则将其留给工具以发现并下载文件。

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

pip install wheel

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

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

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

python -m wheel install wheel_file.whl

另请参阅wheel项目文档

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

For this to work, you do need to install the wheel package:

pip install wheel

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

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

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

python -m wheel install wheel_file.whl

Also see the wheel project documentation.


回答 1

如果您的电脑上已经有一个wheel文件(.whl),则只需执行以下代码:

cd ../user
pip install file.whl

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

pip install package_name

或者,如果您具有网址:

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

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

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

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

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:

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.