简体   繁体   English

我可以有一个 virtualenv specific.pypirc 文件吗?

[英]Can I have a virtualenv specific .pypirc file?

Pip lets it's config file (pip.ini or pip.conf) live inside the virtualenv. Pip 让它的配置文件(pip.ini 或 pip.conf)存在于 virtualenv 中。 That's neat if you want to make your package resolution different in a specific environment.如果你想让你的 package 分辨率在特定环境中有所不同,那就太好了。

But what about the.pypirc file?但是 .pypirc 文件呢? This normally lives in ${HOME}/.pypirc or %USERPROFILE%.pypirc (on Windows).这通常位于 ${HOME}/.pypirc 或 %USERPROFILE%.pypirc(在 Windows 上)。 If you try to create a.pypirc file in the virtualenv's directory it doesnt' seem to be recognized.如果您尝试在 virtualenv 的目录中创建一个 .pypirc 文件,它似乎无法被识别。

Is there a way to specify an alternative location for this file?有没有办法为这个文件指定一个替代位置? For example, can I put it in a virtualenv or specify an alternative location with an environment variable?例如,我可以将它放在 virtualenv 中或使用环境变量指定替代位置吗?

For a virtual environment .env , specify its' path with the parameter --config-file as:对于虚拟环境.env ,使用参数--config-file指定其路径为:

python -m twine upload --config-file .env/.pypirc dist/*

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

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