如何使用PIP安装不同名称的python包 [英] How to install python package with a different name using PIP

查看:25
本文介绍了如何使用PIP安装不同名称的python包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用PIP安装新的python包时,是否可以更改包名,因为还有另一个同名的包?

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 package's name?

推荐答案

导入路径"无法更改(安装名称)通过为 pip 指定参数.所有其他选项都需要某种形式的更改包":

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

A.使用pip install -e git+http://some_url#egg=some-name:这样即使两个包的导入路径相同,它们也会保存在不同的目录下(使用#egg= 之后提供的 some-name).之后,您可以转到包的源目录(通常是venv/src/some-name)并重命名一些文件夹以更改导入路径

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 (usually venv/src/some-name) and rename some folders to change import paths

B-C.Fork 存储库,进行更改,然后从该存储库安装包.或者您可以使用不同的名称在 PyPI 上发布您的包并按名称安装

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.使用 pip download 将其中一个包放入您的项目中,然后根据需要重命名文件夹

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

这篇关于如何使用PIP安装不同名称的python包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆