简体   繁体   中英

Python Poetry, install project into shell's namespace

What is a / the proper way to install Python programs into the shell's namespace via Poetry? With setuptools , you can use $ pip install -e path/to/project and then you can invoke $ project . However I have not found a way to do that with Poetry. Instead I need to use $ poetry run project .

To clarify, I want the following behavior:

$ poetry <some command> path/to/project
$ project
<output of project>

I guess your goal is to install your cli and make changes to it without having to reinstall it?

As you've probably noticed pip install -e doesn't yet support PEP 518 based projects like you get with poetry.

Poetry's solution for this is of course to let you execute installed libs or cli tools with poetry run as you described, or to activate the virtualenv that poetry creates containing your project in a new shell with poetry shell , which is similar to an interactive installation as long as your stay inside that shell.

Of course you can still install the project as usual with pip install. , and mess around with the files as the installed location, though this isn't a recommended workflow.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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