如何在 python 3.4 - .whl 文件中安装
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/29284282/
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
How to install in python 3.4 - .whl files
提问by Matthew Winfield
I recently tried to re-install numpy for python 3.4, since I got a new computer, and am struggling. I am on windows 8.1, and from what I remember I previously used a .exe file that did everything for me. However, this time I was given a .whl file (apparently this is a "Wheel" file), which I cannot figure out how to install.
我最近尝试为 python 3.4 重新安装 numpy,因为我买了一台新电脑,并且很挣扎。我在 Windows 8.1 上,我记得我以前使用过一个 .exe 文件,它为我完成了所有工作。但是,这次我得到了一个 .whl 文件(显然这是一个“轮子”文件),我不知道如何安装。
Other posts have explained that I have to use PIP, however the explanations of how to install these files that I have been able to find are dreadful. The command "python install pip" or "pip install numpy" or all the other various commands I have seen only return an error that "python is not recognized as an internal or external command, operable program or batch file", or "pip is not recognised as an internal...." ect.
其他帖子解释说我必须使用 PIP,但是我能够找到的关于如何安装这些文件的解释是可怕的。命令“python install pip”或“pip install numpy”或我见过的所有其他各种命令只返回一个错误,即“python 未被识别为内部或外部命令、可运行的程序或批处理文件”,或“pip is不被认为是内部……”等。
I have also tried "python3.4", "python.exe" and many others since it does not like python. The file name of the numpy file that I downloaded is "numpy-1.9.2+mkl-cp34-none-win_amd64.whl".
我也试过“python3.4”、“python.exe”和许多其他的,因为它不喜欢python。我下载的numpy文件的文件名是“numpy-1.9.2+mkl-cp34-none-win_amd64.whl”。
So can anybody give me a Detailedtutorial of how to use these, as by the looks of things all modules are using these now. Also, why did people stop using .exe files to install these? It was so much easier!
所以任何人都可以给我一个关于如何使用这些的详细教程,从外观上看,所有模块现在都在使用这些。另外,为什么人们停止使用 .exe 文件来安装这些文件?轻松多了!
采纳答案by TigerhawkT3
Python 3.4 comes with PIP already included in the package, so you should be able to start using PIP immediately after installing Python 3.4. Commands like pip install <packagename>
only work if the path to PIP is included in your path
environment variable. If it's not, and you'd rather not edit your environment variables, you need to provide the full path. The default location for PIP in Python 3.4 is in C:\Python34\Scripts\pip3.4.exe
. If that file exists there (it should), enter the command C:\Python34\Scripts\pip3.4.exe install <numpy_whl_path>
, where <numpy_whl_path>
is the full path to your numpy .whl file. For example: C:\Python34\Scripts\pip3.4.exe install C:\Users\mwinfield\Downloads\numpy?1.9.2+mkl?cp34?none?win_amd64.whl
.
Python 3.4 随附已包含在包中的 PIP,因此您应该能够在安装 Python 3.4 后立即开始使用 PIP。pip install <packagename>
仅当 PIP 的路径包含在您的path
环境变量中时,此类命令才有效。如果不是,并且您不想编辑环境变量,则需要提供完整路径。Python 3.4 中 PIP 的默认位置在C:\Python34\Scripts\pip3.4.exe
. 如果该文件存在(应该),请输入命令C:\Python34\Scripts\pip3.4.exe install <numpy_whl_path>
,其中<numpy_whl_path>
是 numpy .whl 文件的完整路径。例如:C:\Python34\Scripts\pip3.4.exe install C:\Users\mwinfield\Downloads\numpy?1.9.2+mkl?cp34?none?win_amd64.whl
。
回答by Rayyan Merchant
See the easiest solution is to unzip the .whl
file using 7-zip. Then in the unzipped directory you will find the module which you can copy and paste in the directory C:/Python34/Lib/site-packages/
(or wherever else you have installed Python).
查看最简单的解决方案是.whl
使用 7-zip解压缩文件。然后在解压后的目录中,您将找到可以复制并粘贴到目录中C:/Python34/Lib/site-packages/
(或其他任何安装了 Python 的位置)的模块。