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.

 

Advertisements
Tagged , , , , , , ,

9 thoughts on “Python: How to Install 3rd Party Modules without the Command Prompt

  1. codeinfig says:

    😀

    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

    • 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

      • codeinfig says:

        i think idle has got to be importing stuff that it needs or something. sure, youll never find out what, but thats my guess.

        Liked by 1 person

      • 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

      • codeinfig says:

        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

  2. codeinfig says:

    if i say import pygame # then dir() one of the things it will list is ‘pygame’ but only if i import it.

    Liked by 1 person

    • 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

      • codeinfig says:

        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

      • Darn. The lists are the same. Not sure what’s happening there. Good to know I can do this in the future though. You really know your Python. Much appreciated!

        Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: