You can't, RPi.GPIO only works on the Raspberry Pi.
Answer from joan on Stack ExchangeYou can't, RPi.GPIO only works on the Raspberry Pi.
If you are just looking to test the whole code and not worry about the actual pins (as windows machines don't have GPIO), then you can fake it.
First, in your main python source directory, create a directory named "RPi". In that folder, put an empty text file named __init__.py. This lets python know the folder "RPi" is a package. Also in that folder put a text file named "GPIO.py". In that file put the following:
BOARD = 1
OUT = 1
IN = 1
def setmode(a):
print a
def setup(a, b):
print a
def output(a, b):
print a
def cleanup():
print 'a'
def setwarnings(flag):
print 'False'
This puts a pretty blank attribute set that can answer some of the GPIO calls you would most likely be using. Of course, there is no way to actually check whether the calls worked, but you won't get error messages stating the module GPIO doesn't exist. It's pretty hacky, but I use it when I don't feel like ssh into my pi for some quick code updates. You can add any other GPIO attributes you may need.
Adding GPIO to a PC
RS in Laptop o RPi? GPIO in laptop? - Repetier-Forum
GPIO with IDLE/Windows - Raspberry Pi Forums
Pycharm. Programming for Pi in Python on PC. Are libraries required?
Videos
ยป pip install RPi.GPIO
So, the other day I was annoyed doing some debugging and started looking at data acquisition devices and other ways of adding GPIO to a PC. The ones that did what I wanted were crazy expensive, 50k+ USD for a complete expandable setup with 40+ pins and the API is annoying CSV based. I started looking at alternatives and found some old stuff on using a Raspberry Pi but GPIO on a Pi is ehhh at best. Right in front of me on my desk was a bunch of microcontrollers so I said why not and got to work. A few days and some head scratching later I present my PC GPIO project, https://github.com/ByronAP/PCGPIO , I tried to support as much functionality as I could in what little time I have spent on it so far. LED strip control is basic at best and there is still a lot to do and optimize but hey maybe someone else will find it a useful tool. Enjoy ByronAP