如何安装这个轮子?

2024-04-24 22:23:36 发布

您现在位置:Python中文网/ 问答频道 /正文

我设法安装了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

文件与pip在同一个文件夹(脚本)中。

我也试过使用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'

我使用PowerShell,请帮忙!


Tags: inpynonemainliblinetoolpygame
3条回答

pip安装车轮支架:

pip install wheel

安装下载的控制盘:

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

使用pip使用完整路径安装控制盘文件:

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

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

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

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

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

这在我的电脑上使用Python2.7.3(64位),而其他版本不起作用。

相关问题 更多 >