파이썬 venv activate를 하려고 하는데 안됩니다. 관리자 권한으로 켰는데도 똑같습니다.

이유를 찾아보니 파워쉘(PowerShell) 실행 정책(Execution Policy)이 Restricted로 설정되어있기 때문이라고 합니다.

파워쉘 문서를 보니 설명이 써있습니다.

* AllSigned: Requires that all scripts and configuration files are signed by a trusted publisher, including scripts written on the local computer.

* Bypass: Nothing is blocked and there are no warnings or prompts.

* Default: Sets the default execution policy. Restricted for Windows clients or RemoteSigned for Windows servers.

* RemoteSigned: Requires that all scripts and configuration files downloaded from the Internet are signed by a trusted publisher. The default execution policy for Windows server computers.

* Restricted: Doesn't load configuration files or run scripts. The default execution policy Windows client computers.

* Undefined: No execution is set for the scope. Removes an assigned execution policy form a scope that is not set by a Group Policy. If the execution policy in all scopes is Undefined, the effective execution policy is Restricted.

* Unrestricted: Beginning in PowerShell 6.0, this is the default execution policy for non-Windows computers and can't be changed. Loads all configuration files and runs all scripts. If you run an unsigned script that was downloaded from the internet, you're prompted for permission before it runs.

...

뭔소린지 모르겠습니다.

뭐.. 파워쉘에서는 이런식으로 실행 정책을 갖고 권한 관리를 하나봅니다. 참 번거롭네요.

 

실행정책을 Unrestricted로 변경하면 제약이 없어집니다.

 

PS C:\Users\...> Set-ExecutionPolicy Unrestricted

위 명령어를 치면 이제 스크립트와 설정파일을 묻지도 따지지도 않고 쓸 수 있습니다.

반응형