Pipenv global environment

霸气de小男生 提交于 2019-12-06 01:58:52

Installing from Pipenv without a virtual environment

I had a similar problem to you - I needed to install dependencies globally on our production server.

I came across this discussion which alerted me to the --system option. pipenv install --system installs dependencies globally.

Installing only some dependencies globally

There are a couple of other aspects of your question which I thought I should address too:

First of all, you talk about "some" things being global. If you have some dependencies which need to be global and some which need to be in a virtual environment, you could split them into separate Pipfiles and use the PIPENV_PIPFILE environment variable. For example:

# Install your global deps from a separate file
$ PIPENV_PIPFILE="/path/to/global/deps/Pipfile" pipenv install --system

# Use your local Pipfile for the project-specific deps (in a virtual environment as normal)
$ pipenv install

An alternative: pipsi

Secondly, you ask "is this a sane thing to do?" I think is is sane to use Pipenv for global dependencies in general, but for your use case of command-line tools, I would use pipsi. Pipsi installs libraries globally but isolated from each other (see the link for more details). However, I don't think it offers a way of using a requirements file (ref).

For some general reading about Python setup and dependencies, I really recommend Jacob Kaplan-Moss's article My Python Development Environment, 2018 Edition.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!