如何使用 PIP 安装具有不同名称的 python 包

How to install python package with a different name using PIP(如何使用 PIP 安装具有不同名称的 python 包)
本文介绍了如何使用 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= 之后提供的一些名称).在此之后,您可以转到包的源目录(通常是 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 包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

【网站声明】本站部分内容来源于互联网,旨在帮助大家更快的解决问题,如果有图片或者内容侵犯了您的权益,请联系我们删除处理,感谢您的支持!

相关文档推荐

How to draw a rectangle around a region of interest in python(如何在python中的感兴趣区域周围绘制一个矩形)
How can I detect and track people using OpenCV?(如何使用 OpenCV 检测和跟踪人员?)
How to apply threshold within multiple rectangular bounding boxes in an image?(如何在图像的多个矩形边界框中应用阈值?)
How can I download a specific part of Coco Dataset?(如何下载 Coco Dataset 的特定部分?)
Detect image orientation angle based on text direction(根据文本方向检测图像方向角度)
Detect centre and angle of rectangles in an image using Opencv(使用 Opencv 检测图像中矩形的中心和角度)