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.
python - How to install RPi.GPIO to windows - Stack Overflow
How to correctly install the python RPi.GPIO library - Raspberry Pi Stack Exchange
I would like to install a GPIO C# Library for my raspberry pi, how do i go about this?
Raspberry Pi 3 Python 3 GPIO- what's the standard way to do it?
Videos
» pip install RPi.GPIO
Not sure if this is helpful, but under the latest copy of Raspbian I was able to install RPi.GPIO directly from the main repositories using apt-get as follows:
sudo apt-get update
sudo apt-get -y install python-rpi.gpio
If you're running Python 3 (idle3 on the command line) instead of Python 2 (python on the command line) you need to install the RPi.GPIO library with this command instead:
sudo apt-get -y install python3-rpi.gpio
Assuming you have pip, the python package index installer, which is installed on the latest versions of Raspbian by default
You can use:
sudo pip install RPi.GPIO for Python 2
and
sudo pip-3.2 install RPi.GPIO for Python 3