Skip to content Skip to sidebar Skip to footer

Installing Praw

I would like to install PRAW so I can make reddit bots and stuff, but all the install guides are confusing to me so could someone explain how to as noob friendly as possible. I've

Solution 1:

praw is best installed, according to the documentation, via pip. To install pip, you need setuptools. Here is a simple guide on installing pip via setuptools.

Basically, download ez_setup.py and get-pip.py, two Python scripts that automatically get and install setuptools and pip. You'll want to run the following commands in the terminal in the same directory as the location of the files, in order:

python ez_setup.py
python get-pip.py

Finally, you'll want to use pip to get praw. pip is an executable file that is usually located in your python build directory. For example, in Windows, it's located in C:\Python27\scripts. You can add that directory to your system path variable, but right now you can just navigate to that directory where pip.exe is installed. Then, run the following command in the terminal:

pip install praw

Solution 2:

I recently had trouble with this so I thought I would add what I did.

  1. Install Pip - https://pip.pypa.io/en/stable/installing/
  2. install praw pip install praw; This is done on your pc/mac/linux(?) Installation guide
  3. Register on reddit as a developer and register the app. To be able to use the api you need to have a client_id and a client_secret. Get those by registering here. More information about the types of applications can be found here.
  4. Now you are ready to begin coding. This is a good script to verify that you are connecting to the reddit api. The client_id and client_secret are from the previous step and the user_agent is a string that is unique to your app. I used something like 'my first app by /u/myUsername'. The password and username is your reddit login

Run this code and it should output your username.

import praw
reddit = praw.Reddit(client_id='CLIENT_ID',
                     client_secret="CLIENT_SECRET", password='PASSWORD',
                     user_agent='USERAGENT', username='USERNAME')
print(reddit.user.me())

Post a Comment for "Installing Praw"