首页 > 解决方案 > Python PIP 安装 v3.8

问题描述

嗨,我从 Python.org 下载了最新的 python 3.8,并试图继续阅读“Al Sweigart 于 2015 年出版的用 Python 自动化无聊的东西”,它似乎使用 3.4.0。到目前为止,所有示例都使用 IDLE,而不是使用不同的解释器。我现在需要导入模块 pyperclip 以便继续阅读这些章节。但是,安装 PiP 和 3rd 方模块的说明似乎不起作用。当我从 Windows 命令提示符运行 python 时,它说

C:\Users\brentond>python
'python' is not recognized as an internal or external command,
operable program or batch file.

这有效

C:\Users\brentond>py
Python 3.8.0 (tags/v3.8.0:fa919fd, Oct 14 2019, 19:21:23) [MSC v.1916 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.

书的附录 A 说 pip.exe 应该保存在程序 C:\Users\brentond\AppData\Local\Programs\Python\Python38-32 的地方。但这对我来说不是这样。

C:\Users\brentond>pip install pyperclip
'pip' is not recognized as an internal or external command,
operable program or batch file.

>>> C:\Users\brentond>py -m pip install pyperclip
  File "<stdin>", line 1
    C:\Users\brentond>py -m pip install pyperclip
                                            ^
SyntaxError: unexpected character after line continuation character
>>>

请帮忙?

标签: pythonpipinstallation

解决方案


三个尖括号表示您在 Python shell 中。py -m install pyperclip需要从普通命令行执行。退出 Python shell(带有quit()),然后执行C:\Users\brentond>py -m pip install pyperclip.


推荐阅读