2

I am learning Python and Django and want to activate the virtual environment from the PyCharm community edition 2019.3

I can see the venv created under my folder but when I try and activate it using the command

source venv/bin/activate

There's an error -

'source' is not recognized as an internal or external command, operable program or batch file.

enter image description here

I already tried checking the project interpreter and it seems to point to the right path. Below is the screenshot

enter image description here

I have checked the below link as well - How do I activate a virtualenv inside PyCharm's terminal? and tried changing the terminal option, but somehow I am not getting rid of this error -

enter image description here

Can someone please help here?

Thanks, Sanket

Sanket Kelkar
  • 129
  • 2
  • 9

2 Answers2

4

If you are on windows, please use below to activate.

venv\scripts\activate
Mayur Patel
  • 1,741
  • 15
  • 32
  • Hey Mayur, thanks for your reply! I am on windows, in the folder, I can see 3 activate files, .file, .bat, and .ps1. Which one should I use? Should I just open it or run through any command in PyCharm? – Sanket Kelkar Apr 06 '20 at 05:56
  • You should run activate.bat – akazuko Apr 06 '20 at 06:03
  • Run the command `venv\scripts\activate` from pycharm terminal. But as I can see in your screenshot, it's already activated as pycharm automatically do that. – Mayur Patel Apr 06 '20 at 06:09
2

Pycharm automatically activates the virtual environment fo your project, see the (venv) in Pycharm terminal before the folder information.

jcaliz
  • 3,891
  • 2
  • 9
  • 13