Skip to content Skip to sidebar Skip to footer

Using Library Installed In One Virtual Environment In Another Virtual Environment

Can we use library installed in one virtual environment from another virtual environment? For eg: Library installed in venv from another virtual environment.

Solution 1:

Short answer: No

Virtual environment's purpose is to isolate different python instalation, including their libraries. If you ever find a way to do this, it must be considered a hack and should be reported to virtual environment as a bug.

Solution 2:

It should be possible, you just have to import the module by giving the full path to the module present in the source virtualenv. How to import a module given the full path?

But it'll NOT WORK as dependencies to the module will not be present in your target virtualenv. You can try importing all dependencies by using full path it'll work that way.

Post a Comment for "Using Library Installed In One Virtual Environment In Another Virtual Environment"