`pip install -e`的用例是什么? [英] What is the use case for `pip install -e`

查看:4115
本文介绍了`pip install -e`的用例是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我需要处理一个宠物项目时,只需像往常一样(git clone <url>)克隆存储库,编辑所需内容,运行测试,更新setup.py版本,提交,推送,构建打包并将其上传到PyPI.

When I need to work on one of my pet projects, I simply clone the repository as usual (git clone <url>), edit what I need, run the tests, update the setup.py version, commit, push, build the packages and upload them to PyPI.

使用pip install -e有什么优势?我应该使用它吗?它将如何改善我的工作流程?

What is the advantage of using pip install -e? Should I be using it? How would it improve my workflow?

如果这有帮助,这是我目前打包并发送给PyPI的两个宠物项目,但从未使用过pip install -e.一个是纯Python,另一个是Django程序包.

If this helps, here are my two pet projects that I currently package and send to PyPI, but never used pip install -e. One is pure Python, the other is a Django package.

  • https://github.com/jpmelos/subcomm
  • https://github.com/jpmelos/django-generic-models

如何使用pip install -e改善项目的工作流程或结构?

How would the project's workflow or structure be improved by using pip install -e?

推荐答案

如果要使用python package.py运行软件包并从该文件导入项目的其他模块,则使用pip install -e .实际上很有用.该命令使它们可被找到!

Using pip install -e . can actually be useful if you want to run your packages with python package.py and you import other modules of your project from that file. The command makes them findable!

它的作用是:

  • 安装site-packages/PackageName.egg-link文件
  • 将路径添加到site-packages/easy-install.pth
  • (可选)在<venv>/bin
  • 中安装CLI目标
  • installs site-packages/PackageName.egg-link file
  • adds path to site-packages/easy-install.pth
  • optionally installs CLI targets in <venv>/bin

似乎前两者之一就足够了,后者在开发命令行实用程序时很方便.

It seems either of the earlier two is sufficient, and the latter is handy when developing command-line utilities.

这篇关于`pip install -e`的用例是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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