[英]How to export the virtual environment settings in python
I am new to python and pycharm tool.我是 python 和 pycharm 工具的新手。 I have created a project and checked in Git hub.
我创建了一个项目并签入了 Git 中心。 Now one of my friend pulled the changes and tried to run and he encountered with an error message stating "No interpreters found".
现在我的一个朋友提取了更改并尝试运行,他遇到了一条错误消息,指出“找不到解释器”。 When i revalidated the project structure i found that i have 'venv' folder in my project but the person who pulled the changes dosent have it.
当我重新验证项目结构时,我发现我的项目中有“venv”文件夹,但是拉取更改的人已经拥有它。
Can you please help me on this.你能帮我解决这个问题吗?
Thanks in Advance!提前致谢!
PS: I am using Windows OS PS:我使用的是 Windows 操作系统
Usually, you don't check in your venv folder.通常,您不会签入您的 venv 文件夹。
Save the output of pip freeze
in a file called requirements.txt
and check that into your repo.将
pip freeze
的 output 保存在名为requirements.txt
的文件中,并将其签入您的存储库。
Once your friend gets the full code, they can install the dependencies using pip install -r requirements.txt
一旦您的朋友获得完整代码,他们就可以使用
pip install -r requirements.txt
安装依赖项
As you've said you're new to Python, I'll try to explain how things work in Python projects.正如您所说的,您是 Python 的新手,我将尝试解释 Python 项目中的工作原理。
Steps to do setup on your another machine.在另一台机器上进行设置的步骤。
pip freeze
and write them to a text file which contains library names and versions.pip freeze
导出项目的所有已安装和使用的包,并将它们写入包含库名称和版本的文本文件。 Add this file to your project.requirements.txt
.requirements.txt
。 Refer this https://pip.pypa.io/en/stable/reference/pip_freeze/ Note: It's not suggested to have venv folder which contains all your packages inside your project directory itself.注意:不建议在项目目录本身中包含包含所有包的 venv 文件夹。 You may have to add the folder to
.gitignore
just for this purpose.为此,您可能必须将该文件夹添加到
.gitignore
。
You might want to take a look at .idea
folder in project directory.您可能想查看项目目录中的
.idea
文件夹。 But I don't think that would be much useful.但我认为这不会有多大用处。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.