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

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

问题描述

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

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. 运行 pip freeze >远程机器上的requirements.txt
  2. 将该requirements.txt 文件复制到您的本地机器
  3. 在本地虚拟环境中,运行 pip install -r requirements.txt
  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

而且,只要所有要求都是表现良好的 Python 包,您就可以开始使用了.

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

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

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