简体   繁体   English

VirtualEnv - 我应该忽略 venv 文件夹吗?

[英]VirtualEnv - Should I ignore the venv folder?

I am starting to understand the advantages of virtualenv.我开始了解 virtualenv 的优势。 Now, I have created virtualenv folder named venv by doing virtualenv venv .现在,我通过执行virtualenv venv创建了名为venv的 virtualenv 文件夹。

Now my question is, Is it useful to push this folder to github or should I add it to .gitignore ?现在我的问题是,将此文件夹推送到 github 是否有用还是应该将其添加到.gitignore

You should add it to gitignore file.您应该将其添加到 gitignore 文件中。 Then, you should create requirements.txt file and populate it with the packages you have installed.然后,您应该创建requirements.txt文件并使用您安装的软件包填充它。 Then, on your production server, create the virtual environment and run pip install -r requirements.txt .然后,在您的生产服务器上,创建虚拟环境并运行pip install -r requirements.txt

Read this to learn more about the requirements file.阅读本文以了解有关需求文件的更多信息。

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

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