简体   繁体   中英

Is there a way to manage multiple module version within python3.7

I have a requests module version 2.24.0 but I also want to install snowflake-connector-python which requires requests version 2.23.0 or lower. Is there a way to manage these two version in my project without downgrading?

I have seen examples like below which is trying to manage within the file where a different request version is needed import pkg_resources; pkg_resources.require("requests==2.23.0"); import pkg_resources; pkg_resources.require("requests==2.23.0");

but getting error:

> File "/Users/../.venv/lib/python3.7/site-packages/pkg_resources/__init__.py",
> line 791, in resolve
>     raise VersionConflict(dist, req).with_context(dependent_req) pkg_resources.VersionConflict: (requests 2.24.0
> (/Users/../Projects/../.venv/lib/python3.7/site-packages),
> Requirement.parse('requests==2.23.0'))

Please note: I am using virtual environment.

There is no way to manage two different versions of a package within the same Python environment. If snowflake-connector-python is requiring requests 2.23.0 or lower then you'll have to downgrade to requests 2.23.0 or lower in your virtual environment.

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