2

The question is really simple: I have a python package installed using pip3 and I'd like to tweak it a little to perform some computations. I've read (and it seems logical) that is very discouraged to not to edit the installed modules. Thus, how can I do this once I downloaded the whole project folder to my computer? Is there any way to, once edited this source code install it with another name? How can I avoid mixing things up? Thanks!

Esteban
  • 41
  • 1
  • 3
  • I agree it's discouraged. That being said, [this question](https://stackoverflow.com/questions/122327/how-do-i-find-the-location-of-my-python-site-packages-directory) will show you where to find the package. You can make your edits there, save the file and make sure to delete any corresponding (or all) *.pyc files in that directory (they're cached module bytecode and if they exist will be used instead of the source you just edited). – jedwards Aug 15 '19 at 03:31

1 Answers1

2

You can install the package from its source code, instead of PyPi.

  1. Download the source code - do a git clone <package-git-url> of the package
  2. Instead of pip install <package>, install with pip install -e <package-directory-path>
  3. Change code in the source code, and it will be picked up automatically.
Subhash
  • 3,121
  • 1
  • 19
  • 25