Using library installed in one virtual environment in another virtual environment

夙愿已清 提交于 2019-12-11 16:06:55

问题


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


回答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.




回答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.



来源:https://stackoverflow.com/questions/57759298/using-library-installed-in-one-virtual-environment-in-another-virtual-environmen

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