从 WHL 文件安装 Python 库

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/27577463/
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 01:58:16  来源:igfitidea点击:

Installing Python library from WHL file

pythoninstallation

提问by Muhammad Suleman

Skill level: beginner

技能水平:初学者

I am trying to add a library in python. The extension is wheel.

我正在尝试在 python 中添加一个库。扩展名是轮子。

Can somebody tell stepwise approach in installing wheel file?

有人可以告诉逐步安装车轮文件的方法吗?

回答by MarkTab www.marktab.net

First open a console then cd to where you've downloaded your file like some-package.whl and use

首先打开一个控制台,然后 cd 到你下载文件的地方,比如 some-package.whl 并使用

pip install some-package.whl

Note: if pip.exe is not recognized, you may find it in the "Scripts" directory from where python has been installed. I have multiple Python installations, and needed to use the pip associated with Python 3 to install a version 3 wheel.

注意:如果 pip.exe 无法识别,您可以在安装 python 的“Scripts”目录中找到它。我有多个 Python 安装,需要使用与 Python 3 关联的 pip 来安装版本 3 轮子。

If pip is not installed, and you are using Windows: How to install pip on Windows?

如果未安装 pip,并且您使用的是 Windows:如何在 Windows 上安装 pip?

回答by Hewey Dewey

From How do I install a Python package with a .whl file?[sic], How do I install a Python package USING a .whl file ?

如何安装带有 .whl 文件的 Python 包?[原文如此],如何使用 .whl 文件安装 Python 包?

For all Windows platforms:

对于所有 Windows 平台:

1) Download the .WHL package install file.

1) 下载.WHL 包安装文件。

2) Make Sure path [C:\Progra~1\Python27\Scripts] is in the system PATH string. This is for using both [pip.exe] and [easy-install.exe].

2) 确保路径 [C:\Progra~1\Python27\Scripts] 在系统 PATH 字符串中。这是为了同时使用 [pip.exe] 和 [easy-install.exe]。

3) Make sure the latest version of pip.EXE is now installed. At this time of posting:

3) 确保现在安装了最新版本的 pip.EXE。发帖时间:

pip.EXE --version

pip.EXE --version

  pip 9.0.1 from C:\PROGRA~1\Python27\lib\site-packages (python 2.7)

4) Run pip.EXE in an Admin command shell.

4) 在管理命令外壳中运行 pip.EXE。

 - Open an Admin privileged command shell.

 > easy_install.EXE --upgrade  pip

 - Check the pip.EXE version:
 > pip.EXE --version

 pip 9.0.1 from C:\PROGRA~1\Python27\lib\site-packages (python 2.7)

 > pip.EXE install --use-wheel --no-index 
     --find-links="X:\path to wheel file\DownloadedWheelFile.whl"

Be sure to double-quote paths or path\filenames with embedded spaces in them ! Alternatively, use the MSW 'short' paths and filenames.

确保双引号路径或路径\文件名中嵌入空格!或者,使用 MSW 的“短”路径和文件名。