简体   繁体   中英

Python PIP installation v3.8

Hi I downloaded the latest python 3.8 from Python.org and am trying to follow on to "Automate the boring stuff with Python by Al Sweigart published 2015" which appears to use 3.4.0. So far all examples are using IDLE only not a different interpreter. I now need to import the module pyperclip in order to keep going through the chapters. However the instructions for installing PiP and 3rd party modules do not seem to work. When I run python from windows command prompt it says

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

This worked

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.

Appendix A of the book says that pip.exe should be saved where the program is C:\\Users\\brentond\\AppData\\Local\\Programs\\Python\\Python38-32. But this is not the case for me.

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
>>>

Please help?

The three angle brackets indicate you're in a Python shell. py -m install pyperclip needs to be executed from a normal command line. Exit the Python shell (with quit() ), and then execute C:\\Users\\brentond>py -m pip install pyperclip .

So after chatting with IT at work I have worked this out. I'm putting instructions for others who have the book. In the windows command line I paste the full path of the pip.exe and hit return:

C:\Users\brentond\AppData\Local\Programs\Python\Python38-32\Scripts\pip.exe

Then to import the modules:

C:\Users\brentond>py -m pip install pyperclip

and update to latest version of pip

C:\Users\brentond>py -m pip install --upgrade pip

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM