如何将虚拟环境从服务器复制/克隆到本地机器 [英] How to Copy/Clone a Virtual Environment from Server to Local Machine

查看:566
本文介绍了如何将虚拟环境从服务器复制/克隆到本地机器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个现有的Python django项目在Web服务器中运行。现在客户端需要对现有代码进行一些更改。所以我需要在本地机器上进行设置。该项目所需的所有包都安装在虚拟环境中。如何将此虚拟环境复制或克隆到本地计算机来运行此项目。

解决方案


  1. 运行 pip freeze>要求.txt 在远程机器上

  2. requires.txt 文件复制到本地机器

  3. 在您的本地虚拟环境中,运行 pip install -r requirements.txt

而且,只要所有的要求都很好的Python包,你应该很好去。


I have an existing Python django Project running in Web Server. Now the client needs to make some changes in the existing code. So I need to set it up in my Local Machine. All the packages needed for this project is installed in a Virtual environment. How can I copy or clone this virtual environment to my Local machine to run this Project.

解决方案

  1. Run pip freeze > requirements.txt on the remote machine
  2. Copy that requirements.txt file to your local machine
  3. In your local virtual environment, run pip install -r requirements.txt

And, so long as all of the requirements are well behaved Python packages, you should be good to go.

这篇关于如何将虚拟环境从服务器复制/克隆到本地机器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆