How to install python package with a different name using PIP

前端 未结 10 2053
忘了有多久
忘了有多久 2020-12-09 07:56

When installing a new python package with PIP, can I change the package name because there is another package with the same name?

Or, how can I change the existing p

10条回答
  •  独厮守ぢ
    2020-12-09 08:04

    It's not possible to change "import path" (installed name) by specifying arguments to pip. All other options require some form of "changes to package":

    A. Use pip install -e git+http://some_url#egg=some-name: that way even if both packages have the same import path, they will be saved under different directories (using some-name provided after #egg=). After this you can go to the source directories of packages (usuaully venv/src/some-name) and rename some folders to change import paths

    B-C. Fork the repository, make changes, then install the package from that repository. Or you can publish your package on PyPI using different name and install it by name

    D. use pip download to put one of the packages in your project, then rename folders as you like

提交回复
热议问题