简体   繁体   中英

How to ignore the dependencies of a specific package when installing it with pipenv?

Is there a possibility to install a python package with pipenv without also installing the dependencies?

I'm looking for an analogue of pip install package_name --no-dependencies for the Pipfile . I already tried to specify with a marker but it raises an exception.

[packages]
"psycopg2-binary" = "*"
"aiopg"={version = "*", markers="--no-dependencies"}

Although the question is not quite clear, there are a few hacks you can use.


then after the package is installed, just remove it from Pipfile<\/code> and then lock the file using pipenv lock<\/code>


pipenv install --dev <pkg-name><\/code>
this will only install the package in local environment, not in deployment.

I'm not sure pipenv supports that , but I think the following option may work (never tried it):

  1. Install via pip into a requirements.txt file

    pip install <package> --no-deps -r requirements.txt --> then import to pipenv pipenv install -r /path/to/requirements.txt

  2. If you already have a Pipfile in your current project, export your current pipenv file to a requirements.txt file

    pipenv lock -r > requirements.txt

  3. Combine the two files and then pipenv install from the combined requirements.txt file

    pipenv install -r path/to/requirements.txt

Perhaps this link from the docs may help as well

Currently, pipenv does not support this. One workaround adds a script like the following to the end of Pipfile :

[scripts]
install  = "sh -c 'pipenv install ; pip install --no-deps aiopg'"

With this script, calling pipenv run install installs all dependencies from the [packages] section, including aiopg but excluding its dependencies.

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