【问题标题】:Installing Pygame when I have 2 different Python versions installed当我安装了 2 个不同的 Python 版本时安装 Pygame
【发布时间】:2019-10-16 20:38:43
【问题描述】:

我安装了两个版本的 python。 2.7 和 3.7.4。我想将 Pygame 安装到 3.7 但失败了。

我尝试了多个教程和方法,但没有运气。 Python 2.7 包含所有文件,但 3.7 只有 exes 但仍然可以正常工作。

【问题讨论】:

    标签: python python-3.x pygame


    【解决方案1】:

    如果您使用 pip,您可以随时尝试指定要安装的确切 Python 版本:

    $ python2.7 -m pip install pygame
    $ python3.7 -m pip install pypgame
    

    【讨论】:

    • 刚才在3.7目录下通过powershell试了一下,报了这个错误。 python3.7 : The term 'python3.7' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1 + python3.7 -m pip install pygame + ~~~~~~~~~ + CategoryInfo : ObjectNotFound: (python3.7:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
    • 对于 Windows,我会指定 3.7 python.exe 文件的完整路径。
    • 现在我的终端是PS C:\Users\alexa\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Python 3.7>。需要更具体吗?
    • 您可能在此处或下面的bin 目录下有python.exe。我会尝试使用它。
    • 想通了。它显然希望我输入 ./python 而不仅仅是 python。谢谢!
    猜你喜欢
    • 2019-12-24
    • 1970-01-01
    • 1970-01-01
    • 2012-02-13
    • 1970-01-01
    • 2019-06-07
    • 1970-01-01
    • 1970-01-01
    • 2022-12-17
    相关资源
    最近更新 更多