- Problem activating virtual environment on Windows 10:
- # Create virtual env: python -m venv venv
- # Activate the virtual env: . venv/Scripts/activate
- PS C:\projects\docker\fastapi-docker> . venv/Scripts/activate
- . : File C:\projects\docker\fastapi-docker\venv\Scripts\Activate.ps1 cannot be loaded because runn
- https:/go.microsoft.com/fwlink/?LinkID=135170.
- At line:1 char:3
- + . venv/Scripts/activate
- + ~~~~~~~~~~~~~~~~~~~~~
- + CategoryInfo : SecurityError: (:) [], PSSecurityException
- + FullyQualifiedErrorId : UnauthorizedAccess
- ---
- Solution:
- PS C:\Users\..> Get-ExecutionPolicy
- Restricted
- PS C:\Users\..> Set-ExecutionPolicy RemoteSigned
- Execution Policy Change
- The execution policy helps protect you from scripts that you do not trust. Changing the execution policy might expose you to the security risks described in the about_Execution_Policies help topic at https:/go.microsoft.com/fwlink/?LinkID=135170. Do you want to change the execution policy?
- [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N"): Y
- Set-ExecutionPolicy : Access to the registry key
- 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell' is denied. To change the execution
- policy for the default (LocalMachine) scope, start Windows PowerShell with the "Run as administrator" option. To
- change the execution policy for the current user, run "Set-ExecutionPolicy -Scope CurrentUser".
- At line:1 char:1
- + Set-ExecutionPolicy RemoteSigned
- + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- + CategoryInfo : PermissionDenied: (:) [Set-ExecutionPolicy], UnauthorizedAccessException
- + FullyQualifiedErrorId : System.UnauthorizedAccessException,Microsoft.PowerShell.Commands.SetExecutionPolicyCommand
- ---
- If you get that error message, it's because you need to start Powershell as Administrator.
- This is what the commands and output should look like:
- PS C:\WINDOWS\system32> Get-ExecutionPolicy
- Restricted
- PS C:\WINDOWS\system32> Set-ExecutionPolicy RemoteSigned
- Execution Policy Change
- The execution policy helps protect you from scripts that you do not trust. Changing the execution policy might expose you to the security risks described in the about_Execution_Policies help topic at https:/go.microsoft.com/fwlink/?LinkID=135170. Do you want to change the execution policy?
- [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N"): Y
- PS C:\WINDOWS\system32>
Python software and documentation are licensed under the PSF License Agreement.
Starting with Python 3.8.6, examples, recipes, and other code in the documentation are dual licensed under the PSF License Agreement and the Zero-Clause BSD license.
Some software incorporated into Python is under different licenses. The licenses are listed with code falling under that license. See Licenses and Acknowledgements for Incorporated Software for an incomplete list of these licenses.
Python and it's documentation is:
Copyright © 2001-2022 Python Software Foundation. All rights reserved.
Copyright © 2000 BeOpen.com. All rights reserved.
Copyright © 1995-2000 Corporation for National Research Initiatives. All rights reserved.
Copyright © 1991-1995 Stichting Mathematisch Centrum. All rights reserved.
See History and License for complete license and permissions information:
https://docs.python.org/3/license.html#psf-license