Reputation: 33
So I'm trying to install PRAW so I can make reddit bots and the like. Everywhere said that the best way is by using pip. Using this website I've installed pip. The same website then has instructions on installing PRAW here but all the instructions it gives is to use pip and then this code:
pip install praw
It doesn't say where to run this so I assumed in python. I ran it in IDLE and got this message.
SyntaxError: invalid syntax
It also highlights the word "install" in red.
Now I should explain the reason I'm resorting to asking here is because all the dozens of tutorials were either ridiculously vague (like the one above) or too complex for me to understand what is being asked. As such, could I ask that any responses assume computer illiteracy to some degree?
Obviously this isn't the case, but my current knowledge is essentially limited to what I've learnt at school, which is basic python and a smattering of various other things, so to be safe, please refrain from replies like this one which although I'm sure has the solution, I've no idea what it is actually suggesting to do in the second part.
Any help appreciated, sorry if the last 2 paragraphs make me sound picky.
Upvotes: 0
Views: 1038
Reputation: 1367
Well if you succeeded with installing pip
you are very close to actually using it.
Since you haven't specified platform, I'll assume that this is Windows.
You can install packages with pip
in several ways.
Pip
is actually just a file. So you can open your commandline navigate to directory you have python installed in and then navigate to folder scripts
and run it directly from there. For example: assuming you have installed python in C:\python\
you want to run cmd
and navigate to C:\python\Scripts
, since pip
is already installed at this point you can just type pip install praw
and it should execute it.
Above approach might prove annoying when you want to install some packages later, because each time you will have to navigate to that path. So you might want to instead add that folder path to your system environment. You have to go to System
tab in Control Panel and then in Properties
locate Environmental variables
and add Path to your Scripts
folder to either system or user variables depending if your python installation is for all users or local user only. Keep in mind that you have to separate it with semicolon with previous entries, so you'd have to add at the end ;"C:\python\Scripts"
. Now you can call pip
from any working directory.
If you want to use it everywhere but do not want to modify system variables manually and/or have multiple python versions or virtual environments you can call it directly on python you want. By calling python -m pip install praw
you will call pip
associated to python that is called by you using python
command. You can use version manager with this and call stuff like py -2.7 -m pip install praw
or py -3 -m pip install praw
and so on.
There is also a way of using some decent IDE. They usually give you easy GUI for managing python versions and even better ability to quickly manage virtual environments. But this is much broader topic.
Upvotes: 1