You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bug: "pyenv.ps1 is not digitally signed" and "Security warning" #332
See pyenv: File ... cannot be loaded... error (see Screenshots)
Use Set-ExecutionPolicy workaround (see Additional context)
Run pyenv
See Security warning error (see Screenshots)
Use Unblock-File workaround (see Additional context)
Run pyenv and it works.
Expected behavior
Don't need to use Set-ExecutionPolicy and Unblock-File workarounds.
Screenshots
pyenv: File C:\pyenv-win-master\pyenv-win\bin\pyenv.ps1 cannot be loaded. The file C:\pyenv-win-master\pyenv-win\bin\pyenv.ps1 is not digitally signed. You cannot run this script on the current system. For more information about running scripts and setting execution policy, see about_Execution_Policies at https://go.microsoft.com/fwlink/?LinkID=135170.
Security warning
Run only scripts that you trust. While scripts from the internet can be useful, this script can potentially harm your
computer. If you trust this script, use the Unblock-File cmdlet to allow the script to run without this warning
message. Do you want to run C:\pyenv-win-master\pyenv-win\bin\pyenv.ps1?
[D] Do not run [R] Run once [S] Suspend [?] Help (default is "D"):
Desktop (please complete the following information):
OS: [e.g. Windows 7]
Tools used [e.g. command prompt, git bash]
Version [e.g. 22]
Additional context
Running these as a workaround for now:
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope Process
Unblock-File (Join-Path $env:PYENV 'bin' 'pyenv.ps1')
PS C:\Users\kbumsik> pyenv
pyenv : File C:\Users\kbumsik\.pyenv\pyenv-win\bin\pyenv.ps1 cannot be loaded. The file
C:\Users\kbumsik\.pyenv\pyenv-win\bin\pyenv.ps1 is not digitally signed. You cannot run this script on
the current system. For more information about running scripts and setting execution policy, see
about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ pyenv
+ ~~~~~
+ CategoryInfo : SecurityError: (:) [], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
I got this error when running it in Powershell. Running pyenv on Command Prompt seems fine.
Reacted by Darius Murawski and Alina Mukhomediarova
You can experiment with another policies and scopes (if you wish), but I think mentioned in command will be enough for using pyenv
UPD: it's worth to mention that you (maybe) need to RESTART POWERSHELL WINDOW UPD2: Oh, sorry! I missed that reporter tries to install 'pyenv-win' to custom folder on system disc. Probably, in that case command from commenter below is really needed (or try less restricted policy and check that you added this custom folder to User PATH)
Reacted by RedNam, ramen curator, HunZoo Seok, japellaniz, helpingstar, 宇宙超级无敌暴龙战士, Nenad Maljukan, Siddharth Patel, Yunfei Yin, PCDSandwichMan and 8 more
Reacted by Precious
Reacted by 宇宙超级无敌暴龙战士, Yunfei Yin, PCDSandwichMan and Peekabooooooooooo
Reacted by Alina Mukhomediarova, HunZoo Seok, 宇宙超级无敌暴龙战士, Necrelox, Yunfei Yin, PCDSandwichMan, João Pedro Campos, Aymen Abid Boukadida and Peekabooooooooooo
[note the syntax in the Unblock-File statement is slightly different to OP's]
Reacted by stoilmmm, Steve Solun, adityasingh7311, Arthur Cai, anyaIDUN, Emmanuel GUENOU, ahxfast, Erik Bauer, Grace Yudha Satriawan, oandersonmagalhaes and 12 more
Reacted by Austin Swinney and Ryn.
Reacted by Anthony Palazzetti, Daisuke Kato, Steve Solun, Arthur Cai, anyaIDUN, Hiro Matsu, Austin Swinney, Yugendran Sunder, Ryn. and Gaurav~
This doesn't directly fix the issue. But this is like a quick solution to be able to work while somebody else gives a permanent solution.
So, the only way I was able to run pyenv was by manually writing pyenv.bat, that way it works as normal, but if I run pyenv it gives the same error.
While having the same problem What I noticed was, when we include the bin folder into the paths, that makes up able to run anything inside that bin folder, so when we run 'pyenv' it will look into all the Window's path folder and try to run or execute any file with that name, so when we run pyenv windows tries to execute anything with that name, so what it picks as first is the .ps1 intead of the .bat file which is there. I know if there was a .exe will be the default but idk why it's picking the ps1 first.
Activity
biofsphere commentedon Nov 22, 2021
Same here. Had to set execution policy to Unrestricted in order for pyenv to run. Installed using choco.
kbumsik commentedon Nov 23, 2021
I am affected too.
I got this error when running it in Powershell. Running
pyenvon Command Prompt seems fine.hotenov commentedon Feb 20, 2022
This is not a pyenv-win issue. This is PowerShell feature =)
If you follow the Microsoft link in the error description you'll find valuable information about resolving this error 😇
Long story short, execute this command in PowerShell:
You can experiment with another policies and scopes (if you wish), but I think mentioned in command will be enough for using
pyenvUPD: it's worth to mention that you (maybe) need to RESTART POWERSHELL WINDOW
UPD2: Oh, sorry! I missed that reporter tries to install 'pyenv-win' to custom folder on system disc. Probably, in that case command from commenter below is really needed (or try less restricted policy and check that you added this custom folder to User PATH)
adejones commentedon Feb 25, 2022
Just to add to the comment above, you need both statements:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUserUnblock-File (Join-Path $env:PYENV 'bin/pyenv.ps1')[note the syntax in the Unblock-File statement is slightly different to OP's]
fhillipgcastillo commentedon Apr 4, 2022
This doesn't directly fix the issue. But this is like a quick solution to be able to work while somebody else gives a permanent solution.
So, the only way I was able to run
pyenvwas by manually writingpyenv.bat, that way it works as normal, but if I runpyenvit gives the same error.While having the same problem What I noticed was, when we include the bin folder into the paths, that makes up able to run anything inside that bin folder, so when we run 'pyenv' it will look into all the Window's path folder and try to run or execute any file with that name, so when we run
pyenvwindows tries to execute anything with that name, so what it picks as first is the .ps1 intead of the .bat file which is there. I know if there was a .exe will be the default but idk why it's picking the ps1 first.its-prithvi-raj commentedon Apr 30, 2022
Thanks a lot, @adejones !! It did wonders!
kirankotari commentedon May 30, 2022
Hi All, I have updated this information in README file and given a reference to this issue for more information. This will help new users.
I am closing this issue.
quoclam-doit commentedon May 20, 2023
'Set-ExecutionPolicy' is not recognized as an internal or external command,
operable program or batch file.
Please help me the result status and i don't know what happend
steve15963 commentedon Aug 5, 2026
I think this command is safer.
The execution policy resets as soon as you close the terminal session,
keeping your system safe.
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope Process