本文介绍了PyCharm:始终将 venv 目录标记为排除的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Python 3 中,我已经不再在 ~/.virtualenvs 中创建 virtualenv,而是将它们保存在项目目录 ./venv

In Python 3, I've moved away from creating virtualenvs in ~/.virtualenvs and towards keeping them in the project directory ./venv

然而,现在每个 PyCharm 项目中的搜索结果都包括来自 venv 子目录的结果,直到您手动右键单击并将它们从项目中排除.

However now search results in every PyCharm project include results from venv subdirectories, until you manually right-click and exclude them from the project.

如何从 PyCharm 索引/搜索中全局省略名为 venv 的目录?

How to omit directories named venv from PyCharm indexing/searching, globally?

推荐答案

In File >设置 >项目:>底部的项目结构Exclude files:你可以在那里放一些东西

In File > Settings > Project: > Project Structure at the bottom is Exclude files: You can put something in there like

venvvenv;coverage.xml(根据您的评论)

venv or venv;coverage.xml (given your comment)

它似乎无法识别路径(例如 foo/venv),但这符合您的要求.

It doesn't seem to recognize paths (e.g. foo/venv), but this does what you requested.

这篇关于PyCharm:始终将 venv 目录标记为排除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-15 14:14