I am new to Python so maybe this is not an appropriate question. I am working on a project on Python that will use GPIO functionalities of the raspberry Pi. Right now, I am developing the python code on my local windows environment. This is because it is faster to work this way for me. I have it in a git repository so that when I want to test the code I just log into my raspberry pi and pull the latest code found on the repository.

However, I want to implement the code that will interact with the raspberry pi GPIO pins. I have downloaded the GPIO python source: RPi.GPIO 0.5.11, but I do not know how to add it into my python project on windows in order to use the GPIO functionality.

  • You should be able to work remotely with code on the pi, see raspberrypi.stackexchange.com/q/36398/5538, joan also left a comment along these lines on her answer.
    – goldilocks
    Commented Jun 22, 2016 at 16:19
  • Don’t use that non-standard library in the first place. With libgpiod, which has a python bindings, you may experiment in virtual environments of basically any Linux OS.
    – 0andriy
    Commented Jun 9, 2022 at 21:58

5 Answers 5


You can't, RPi.GPIO only works on the Raspberry Pi.

  • thanks. i wil need to manually change the code on deploy.
    – luisgepeto
    Commented Aug 5, 2015 at 7:09
  • 3
    @LuisBecerril If the Pi is networked you could use NFS/Samba to mount your PC's directory. I use a Linux PC and just export my code directory as /code on the Pi. Alternatively, if you are a programmer, you could use my pigpio Python module. A daemon runs on the Pi but the Python script can run on a Windows, Mac, Linux machine.
    – joan
    Commented Aug 5, 2015 at 7:36

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:

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.

  • 1
    this is actually quite a tidy, simple solution.
    – paddyg
    Commented Jul 27, 2016 at 11:03
  • The file name is wrong because it's been interpreted as markup. It should have two leading and trailing underscores e.g. __init__.py Commented Jul 27, 2016 at 11:36

you can use:


This Raspberry Pi emulator simulates some of the functions used in the RPi.GPIO library (using python). The intention of this library is educational.



PyCharm is a great IDE for Python.

Hidden deep in the settings is a way by which you can download different libraries to import in your program. Anything, from the conventional numpy and kivy, to the Pi standard RPi.GPIO, to externally developed ones like pigpio (that's what I use on my Pi, because it has a daemon and doesn't get interrupted by the system processes).

You can get it on the JetBrains website. There's a free (they call it PyCharm Community) version, and a Pro version, both on the JetBrains website. I find the Community version satisfactory.

The downside is that it's not the most intuitive software, and it takes a while to find out how exactly you do stuff. But after a while, one finally gets the hang of it.

You can type your code on your PC using PyCharm, upload it, and then pull it on your Pi when you want to run it.

  • 6
    This answer does not provide any information how to install RPi libraries and thus should not be considered as a valid answer. Just plugging IDE does not provide solution.
    – stiebrs
    Commented Mar 25, 2019 at 9:08
  • "Hidden deep in the settings is a way by which you can download different libraries to import in your program" -- And where is this setting??? Commented Apr 27, 2021 at 18:43
  • If this answer wasn't written in 2017 I'd have thought it was generated by ChatGPT.
    – Nullcaller
    Commented Apr 28 at 20:30

You could try gpiozero library instead of RPi.GPIO. It can be installed in your dev environment and tested in Pi.

Not the answer you're looking for? Browse other questions tagged or ask your own question.