Home > Enterprise >  How to create project with venv (not virtualenv) in Pycharm?
How to create project with venv (not virtualenv) in Pycharm?

Time:01-15

I'm talking about the venv module inside the Python Standard Library, not virtualenv.

When I create a new project, I can't find venv. (PyCharm 2022.3 Professional)

enter image description here

Although the official Pycharm documentation also says "For Python 3.3 the built-in venv module is used, instead of the third-party virtualenv utility.", the tutorials that follow are actually based around virtualenv. I even thought it meant that Pycharm would automatically use venv instead of virtualenv. But when I tried it, I found that it didn't create the same project as python -m venv.

Has been searched many times, but can't find feasible guidelines. But creating via python -m venv and opening it in Pycharm automatically recognizes the virtual environment, which makes me even more confused.

CodePudding user response:

I think you need to activate the venv by using a command source /venv/bin/activate in the terminal to access the venv evironment. I typically open it seperatelly in the linux terminal or visual studio has a built in terminal as well.

CodePudding user response:

There is an open issue about clarifying the documentation about the default virtual environment tool used.

If you try to create a virtual environment using Pycharm in Python 3.3 , it actually creates it using virtualenv, not venv. You can check pyvenv.cfg inside the virtual environment folder to verify this.

I think the documentation is simply inaccurate in this case.

  • Related