Python 这个轮子怎么安装?

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

How to install this wheel?

pythonpygamepippython-3.4python-wheel

提问by DedSecz

I managed to install pip but when I use pip to install the downloaded wheel, it prints:

我设法安装了 pip,但是当我使用 pip 安装下载的轮子时,它会打印:

C:\Python34\Scripts\pip install pygame-1.9.2a0-cp34-none-win_amd64.whl
Requirement 'pygame-1.9.2a0-cp34-none-win_amd64.whl' looks like a filename, but the file does not exist
pygame-1.9.2a0-cp34-none-win_amd64.whl is not a supported wheel on this platform

The file is in the same folder (Scripts) with pip.

该文件与 pip 位于同一文件夹(脚本)中。

I did try to use the wheeltool too:

我也尝试使用该wheel工具:

C:\Python34\Scripts\wheel install pygame-1.9.2a0-cp34-none-win_amd64.whl
Traceback (most recent call last):
  File "C:\Python34\lib\site-packages\wheel\tool\__init__.py", line 358, in main
    args.func(args)
  File "C:\Python34\lib\site-packages\wheel\tool\__init__.py", line 301, in install_f
    args.wheel_dirs, args.force, args.list_files)
  File "C:\Python34\lib\site-packages\wheel\tool\__init__.py", line 202, in install
    raise WheelError("No such wheel file: {}".format(req))
wheel.tool.WheelError: No such wheel file: pygame-1.9.2a0-cp34-none-win_amd64.whl
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "C:\Python34\lib\runpy.py", line 170, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Python34\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Python34\Scripts\wheel.exe\__main__.py", line 9, in <module>
  File "C:\Python34\lib\site-packages\wheel\tool\__init__.py", line 361, in main
    sys.stderr.write(e.message + "\n")
AttributeError: 'WheelError' object has no attribute 'message'

I use PowerShell, please help!

我使用PowerShell,请帮忙!

采纳答案by Martijn Pieters

Use pipto install wheel files using the full path:

用于pip使用完整路径安装轮文件:

C:\Python34\Scripts\pip install C:\Python34\Scripts\pygame-1.9.2a0-cp34-none-win_amd64.whl

Without the path the name is seen as a requirement rather than a already-downloaded file. This should work for wheel files that support your current Python architecture. You can verify your architecture with:

如果没有路径,名称将被视为要求而不是已下载的文件。这应该适用于支持您当前 Python 架构的轮文件。您可以通过以下方式验证您的架构:

C:\Python34\python.exe -c "import distutils.util; print(distutils.util.get_platform())"

This should print win_amd6. If it prints win32instead, you have a 32-bit Python binary and need to pick a different wheel.

这应该打印win_amd6. 如果它win32改为打印,则您有一个 32 位 Python 二进制文件,需要选择不同的轮子。

回答by Malik Brahimi

Install wheel support for pip:

安装车轮支架pip

pip install wheel

Install the downloaded wheel:

安装下载的轮子:

pip install path/to/pygame-1.9.2a0-cp34-none-win_amd64.whl

回答by smartroad

I had to remove the 64bit python and install the 32bit version to solve this issue.

我不得不删除 64 位 python 并安装 32 位版本来解决这个问题。

c:\python34\scripts\pip install c:\users\USER\downloads\pygame-1.9.2a0-cp34-none-win32.whl
Unpacking c:\users\USER\downloads\pygame-1.9.2a0-cp34-none-win32.whl
Installing collected packages: pygame
Successfully installed pygame
Cleaning up...

Worked fine with 32bit :)

在 32 位上运行良好:)

回答by TingtingW

pip install pygame-1.9.2a0-cp27-none-win_amd64.whl

pip 安装 pygame-1.9.2a0-cp27-none-win_amd64.whl

this worked on my computer with Python2.7.3(64bit) while other versions not worked.

这在我的计算机上使用 Python2.7.3(64 位)运行,而其他版本不起作用。

回答by Mark

i tried a different version using 64 bit anaconda and it works fine

我使用 64 位 anaconda 尝试了一个不同的版本,它工作正常

pip install pygame-1.9.2a0-cp35-none-win_amd64.whl

cp35 works a charm.

cp35 很有魅力。