I have a module installed using pip
in a virtualenv
. I want to experiment with a single change on one line of its code, and wonder if it will work by going straight to the source file and changing that line?
If not, what is the easiest way to do so? Download the source, change it, and run python setup.py install
inside the virtualenv
? But would that install the module inside the virtualenv
? And can I still remove it later using pip
or I need to clean it up manually?
As long as the module you wish to edit is written in pure Python, changing the source code in the virtualenv's site-packages directory should work just fine. If the module is a C-extension, then you will need to recompile the module before the changes take effect.
Edit: Note that if you are working with the module in an interactive session, you will need to reload the module in the session (and re-instantiate any object instances based on that module) each time you make a change.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With