简体   繁体   English

如何在venv中获取python的特定全局package(模块)?

[英]How to get specific global package (module) of python in venv?

I had installed TensorFlow of 586 MB in my ubuntu now if I create any venv environment I have to redownload it in the venv.我现在在我的 ubuntu 中安装了 586 MB 的 TensorFlow,如果我创建任何 venv 环境,我必须在 venv 中重新下载它。 is there any way by that I can get the TensorFlow from global to my venv without downloading or having extra modules.有什么方法可以让我将 TensorFlow 从全局获取到我的 venv,而无需下载或拥有额外的模块。

Normally pip wouldn't need to download tensorflow again, as it keeps copies of downloaded artifacts in a local cache on the file system.通常pip不需要再次下载tensorflow ,因为它会将下载的工件的副本保存在文件系统的本地缓存中。 But it would need to install it in each virtual environment , unless...但它需要在每个虚拟环境中安装它,除非......

Maybe venv 's --system-site-packages option is what you are looking for:也许venv--system-site-packages选项是您正在寻找的:

https://docs.python.org/3/library/venv.html?highlight=system%20site%20packages#creating-virtual-environments https://docs.python.org/3/library/venv.html?highlight=system%20site%20packages#creating-virtual-environment

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM