Part of getting error when you start (venv)
when I wanna start django project, I have problem with IDE text editor (in this case I use Visual Studio Code). Maybe this is the first time you’ve experienced it, and you’ve got an error like the one below:

As usual, when we start a virtual environment, let’s assume that you are already in the directory where you will start your django project. in this case I saved it in a directory at i:Python Backend/ecommerce. using the windows operating system, I first created a virtual environment with the command :
py -m venv venv
then I want to run the virtual environment with the command:
venv/Scripts/activate

The error message you are getting is because the execution policy on your system is set to Restricted
. This means that scripts cannot be run without your explicit permission. To fix this, you need to change the execution policy to RemoteSigned
or Unrestricted
.
how to solve a problem like this?
Here are the steps in detail:
- Open PowerShell as administrator.
- Run the following command:
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
- Press
Enter
. - Try running the
venv\Scripts\activate
command again.
If you are still getting errors, you can try changing the execution policy to Unrestricted
. However, this is not recommended, as it allows you to run scripts from anywhere, even if they are not from a trusted source.
Here is the command to change the execution policy to Unrestricted
:
Set-ExecutionPolicy Unrestricted -Scope CurrentUser
Once you have changed the execution policy, you should be able to run the venv\Scripts\activate
command without any errors.
the end result should be something like this:

hope this help. See another what I post soedarhana.id