virtualenv not activated on windows 11

Question:

Im using python 10 and windows-11
i try to activate venv with the following command

.onlineShopScriptsactivate.bat

I create venv using following command

python -m venv onlineShop

My pip list

Package      Version
------------ -------
distlib      0.3.4
filelock     3.6.0
pip          22.0.4
platformdirs 2.5.2
pyaes        1.6.1
Pyrogram     2.0.17
PySocks      1.7.1
setuptools   58.1.0
six          1.16.0
virtualenv   20.14.1

also when Im using .onlineShopScriptsactivate gives me this Error

"cannot be loaded because the execution of scripts is disabled on this system".

Problem : venv is not activated
Asked By: MR.babady

||

Answers:

According to Microsoft Tech Support, it might be a problem with Execution Policy Settings. To fix it, you should try executing the Set-ExecutionPolicy Unrestricted -Scope Process

OR IF this problem is not gone Then please read this answer

To activate

.<Virtual-Name>Scriptsactivate

or

.<Virtual-Name>Scriptsactivate.bat

FOR deactivating venv

.<Virtual-Name>Scriptsdeactivate.bat

or

.<Virtual-Name>Scriptsdeactivate

or

deactivate 

If you got any error while activating the virtual Environment:

cannot be loaded because
running scripts is disabled on this system. For more information, see about_Execution_Policies at
https:/go.microsoft.com/fwlink/?LinkID=135170.

This means your Execution Policy is Restricted SO. To get rid of this error you can run this command.

In Command Prompt:

powershell Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted

In Powershell:

Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted

Replace <Virtual-Name> with your virtual environment name

Answered By: codester_09

Execute following command :

Set-ExecutionPolicy Unrestricted CurrentUser

If you use this command then you will not face this issue again but if you use below command :

Set-ExecutionPolicy Unrestricted -Scope Process

Then you need to execute it again and again.

Answered By: Akshay singh