简体   繁体   中英

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.

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.

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.

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