如何通过pip为Python 3.5安装Pygame? [英] How to installing Pygame for Python 3.5 via pip?
问题描述
我正在尝试为python 3.5 32bit安装Pygame.我了解到可以使用pip
命令打开站点上提供的.whl
文件.问题是我尝试了多种方法来执行此操作,但始终存在错误.
I'm trying to install Pygame for python 3.5 32bit. I have learned that I can open the .whl
files provided on the site by using the pip
command. The problem is I've tried multiple ways doing this but with constant error.
python -m pip install pygame-1.9.2a0-cp35-none-win32.whl
'python' is not recognized as an internal or external command,
operable program or batch file.
我要安装的文件:pygame-1.9.2a0-cp35-none-win32.whl
我的python程序位于我的程序文件夹中,并且其他所有东西都工作正常.
My python program is located in my programs folder and everything else works fine.
推荐答案
您需要将 python.exe 添加到 Windows PATH
变量. /strong>
You need to add python.exe to your Windows PATH
variable.
这是系统变量,操作系统使用该变量从命令行或终端"窗口中查找所需的可执行文件. [1]
The is the system variable that the operating system uses to locate the needed executables from the command line or Terminal windows. [1]
实际上,有很多方法可以在Windows上设置PATH
变量.一种方法是输入
Actually there are many methods to set the PATH
variable on windows. One way is to type
set PATH=%PATH%;
Python.exe
进入Windows命令行解释器(cmd):
into the windows command-line interpreter (cmd):
set PATH=%PATH%;C:\Python35-32
现在-运行pip command
之前-您需要确保其中一个
Now -- before running the pip command
-- you need to make sure that either
- 您的 工作目录 设置为与
pygame-1. ... in32.whl
文件位于
或
- 您提供
pip
命令的完整绝对路径或相对路径.
- your working directory is set to the same folder where your
pygame-1. ... in32.whl
file is located
or - you supply the full absolute or relative path to the
pip
command.
现在,重新启动cmd.exe
之后,您应该能够运行python -m pip
命令.
Now you should be able to run your python -m pip
command after restarting the cmd.exe
.
这篇关于如何通过pip为Python 3.5安装Pygame?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!