Python: How to Install 3rd Party Modules without the Command Prompt

Header

FINALLY. After weeks of errors and several bottles of wine, I managed to load a 3rd party module to get some more Python going.

You can download Python here by the way.

Al Sweigart, author of the best programming book of all time, has an appendix which explains that you can install 3rd party modules with pip. It comes installed standard, and you should be able to run it through the command prompt. HOWEVER, when I first tried it that way, alls I got was a deluge of errors.

Somewhere buried in a Stack Overflow thread which I can’t find anymore, someone mentioned that you can actually import pip into the Python IDLE and run it from there.

IDLE

The shell will pop up afterwards with a block of text.

Beautiful Soup

Ta Da. Now we have BeautifulSoup.

I wish I could tell you that here end the errors, but immediately after I started trying scripts with BeautifulSoup, I started getting a whole different set of errors.

But seeing as how it’s installed, I’m calling that progress.

The more I try to automate things with code, the more I’m coming to accept that it’s about 2% writing, 98% trying to figure out what the hell is causing this:

Errors

What’s genuinely frustrating is that once I imported one module through IDLE, pip started working through the command prompt. I have absolutely no idea why.

 

10 Replies to “Python: How to Install 3rd Party Modules without the Command Prompt”

  1. 😀

    you are beautiful! now try it with colorama in python 2 and tell me what happens. and if it works, you may have solved a problem thats been bugging me for TWO YEARS (im not using windows and you are; i dont need colorama EXCEPT for windows users.)

    Liked by 1 person

    1. Couldn’t get it to work in the command prompt, but it worked in the IDLE with the code above (why? WHY? JUST WHY? THERE HAS TO BE A REASON??) — I swear I had the command prompt working yesterday. I think my computer is just toying with me.

      Liked by 1 person

      1. Yup, that sounds about right, but yeah, I’ll never find out for sure. Happy 4th of July Codeinfig! Well, Happy 4th if you’re in the States, otherwise happy random Tuesday in July 🙂

        Like

      2. its a little of both of those, really. thanks of course. hey just for fun, run python from the command line and in the repl, type this:

        dir()

        and then this:

        for p in dir(): dir(p) # which gives you a lot more.

        then do the same in idle and compare them. might help. might not. cheers.

        Liked by 1 person

    1. OH. OH, THAT’S COOL. I didn’t know you could do that. Both the command prompt and IDLE gave me a ton of text–I haven’t been able to comb through them to figure out if there’s anything different yet, but thanks for sending that my way!

      Liked by 1 person

      1. if you modify this code, it might help you comb through the lists:

        def inst(p, e): #public domain
            try: return p.index(e)
            except: return -1
        
        o = [] # put items here
        p = [] # put items here
        
        print ("x only: ")
        for y in o:
            if inst(p, y) == -1: print(y)
        
        print("")
        
        print ("y only: ")
        for x in p:
            if inst(o, x) == -1: print(x)

        Liked by 1 person

Leave a comment