简体   繁体   中英

How to create virtualenv and include non-global associated installed libraries

Several questions address the way to make a virtualenv that does include global site-packages. I'm looking for something different: how to create a new virtualenv based on a Python executable from another location in my network, and also to include the libraries that are installed in that location in the network.

I have a local desktop machine, but there is an IT-maintained version of Python and associated installed libraries, and it is the ubiquitous Python used by developers. I'm using virtualenv to create several local versions of Python that allow me to try out libraries or change settings, but I'd also like to maintain an installation that is nothing but a pure mirror of that IT-maintained system.

So the question is how to make a virtualenv that points at that IT-maintained Python, and which does reference the previously installed packages for that Python and not for my local machine's global site-packages, etc.

这不是完全相同的事情,但是您可以尝试针对该版本的Python运行pip freeze > requirements.txt ,然后在您的virtualenv中使用带有pip install -r requirements.txt的结果文件在此处安装模块的副本。

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