简体   繁体   English

Python在程序安装程序上安装pip模块?

[英]Python install pip modules on program setup?

I have written a script that requires a couple of modules to be installed through pip. 我编写了一个脚本,该脚本要求通过pip安装几个模块。 The idea of the program is to distribute to users, but I don't want the user to have to install the dependencies with pip. 该程序的想法是分发给用户,但我不希望用户必须使用pip安装依赖项。

Ideally, I'd like them to be able to execute a setup.py script first that would install the required modules. 理想情况下,我希望他们能够首先执行setup.py脚本,该脚本将安装所需的模块。

Ex: user runs setup.py pip install foo 例如:用户运行setup.py pip install foo

I'm new to the packaging thing. 我是包装材料的新手。 Thanks for any info. 感谢您提供任何信息。

Y ÿ

According to this setup takes an argument install_requires and automatically downloads the required packages from PyPI. 根据设置,接受一个参数install_requires并自动从PyPI下载所需的软件包。 An additional argument of dependency_links can be used to specify the links to the source code of packages not hosted on PyPI. 可以使用dependency_links的附加参数来指定指向未托管在PyPI上的软件包的源代码的链接。

You could follow the steps mentioned here and put your code on PyPI so that users can install your package easily. 您可以按照此处提到的步骤将代码放在PyPI上,以便用户可以轻松安装您的软件包。

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

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