简体   繁体   English

如何在 PyCharm 中运行与 distutils 打包的 python 程序?

[英]How to run a python program packaged with distutils from source in PyCharm?

I cloned a repo that has a python project such as gitlabber that is supposed to be packaged with distutils.我克隆了一个包含 python 项目的存储库,例如应该与 distutils 打包的gitlabber If I pick what looks to be the entry point, I just get a module resolution error.如果我选择看起来像入口点的东西,我只会得到一个模块解析错误。

gitlabber/gitlabber/__main__.py
Traceback (most recent call last):
  File "__main__.py", line 1, in <module>
    from .cli import main

ImportError: attempted relative import with no known parent package

I can run it by我可以运行它

pip install. pip 安装。 and then running it as a command.然后将其作为命令运行。

pip install .
gitlabber -t -i

But I want to change the source code, run in debug mode, and run without installing it with pip every time, like a normal python developer.但是我想更改源代码,在调试模式下运行,并且每次都像普通的 python 开发人员一样,在不安装 pip 的情况下运行。 How do I do that?我怎么做?

I seriously did google this and did not find any good material.我认真地google了这个,没有找到任何好的材料。 Probably because it's assumed to be too basic.可能是因为它被认为太基础了。

To install with a setup.py file:使用 setup.py 文件安装:

python setup.py install

To install with pip in edit mode use -e.要在编辑模式下安装 pip,请使用 -e。 I think this is what you are looking for.我想这就是你要找的。

pip install -e .

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM