In Python 3, I've moved away from creating virtualenvs in ~/.virtualenvs
and towards keeping them in the project directory ./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.
How to omit directories named venv
from PyCharm indexing/searching, globally?
PyCharm allows you to exclude directories from consideration when searching and refactoring. You can exclude a directory by right-clicking on it and selecting Mark Directory as → Excluded.
You can clean out old PyCharm interpreters that are no longer associated with a project via Settings -> Project Interpreter, click on the gear in the top right, then click "More". This gives you a listing where you can get rid of old virtualenvs that PyCharm thinks are still around.
PyCharm can create a virtual environment for your project based on the project requirements.
In File > Settings > Project: > Project Structure
at the bottom is Exclude files:
You can put something in there like
venv
or venv;coverage.xml
(given your comment)
It doesn't seem to recognize paths (e.g. foo/venv
), but this does what you requested.
You can globally exclude a directory in PyCharm by following the Breadcrumb trail:
Settings > Editor > File Types > Ignore Files and Folders:
At the bottom is a text box where you can input the symbolic link ./venv
relative to your projects base directory, highlighted in the picture:
After that, new projects have ./venv
excluded by default. You don't need to repeat the above steps for new projects. In use, "Find in Path" shows:
P.S. I also started keeping my venvs inside their project directories. Once you have dozens of projects it just becomes convenient.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With