简体   繁体   English

如何使用需要 CLI args 的 Poetry 安装包?

[英]How to install a package with Poetry that requires CLI args?

Here's an example that requires it:这是一个需要它的示例:

poetry add pycurl

... gives: ImportError: pycurl: libcurl link-time ssl backend (openssl) is different from compile-time ssl backend (none/other) ...给出: ImportError: pycurl: libcurl link-time ssl backend (openssl) is different from compile-time ssl backend (none/other)

The fix is given in that post:该帖子中给出了修复程序:

pip install --compile --install-option="--with-openssl" pycurl

How to package-manage my project now?现在如何打包管理我的项目?

Must I use poetry for everything else, and manually pip install pycurl?我必须将poetry用于其他所有内容,并手动pip install pycurl 吗?

Or can I somehow fold it into my pyproject.toml ?或者我可以以某种方式将它折叠到我的pyproject.toml吗?

Although this is old, I would like to share an alternative to re-install the package with the CLI options.虽然这很旧,但我想分享一个使用 CLI 选项重新安装软件包的替代方法。

I do not know if running this with Poetry could cause any damage, but I would believe not.我不知道用诗歌运行它是否会造成任何损害,但我相信不会。

First you'd have to activate your poetry environment with poetry shell .首先你必须用poetry shell激活你的诗歌环境。 After that, get the current version of pycurl that is installed using pip list , and copy that value.之后,获取使用pip list安装的pycurl的当前版本,并复制该值。

Now, you can run pip install --compile --install-option="--with-openssl" --upgrade --force-reinstall pycurl==<version> to install it with the correct options.现在,您可以运行pip install --compile --install-option="--with-openssl" --upgrade --force-reinstall pycurl==<version>以使用正确的选项安装它。

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

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