Python: how to edit an installed package?

前端 未结 2 1064
忘掉有多难
忘掉有多难 2020-11-28 20:15

I installed some package via pip install something. I want to edit the source code for the package something. Where is it (on ubuntu 12.04) and how

2条回答
  •  悲&欢浪女
    2020-11-28 20:34

    You should never edit an installed package. Instead, install a forked version of package.

    If you need to edit the code frequently, DO NOT install the package via pip install something and edit the code in '.../site_packages/...'

    Instead, put the source code under a development directory, and install it with

    python setup.py develop
    # or
    pip install -e path/to/SomePackage
    # Or use a vcs at the first place
    $ pip install -e git+https://github.com/lakshmivyas/hyde.git#egg=hyde
    

    Put your changes in a version control system, and tell pip to install it explicitly.

    Reference: Edit mode

提交回复
热议问题