How do I add Python 3.3 to Powershell?

前端 未结 2 726
一向
一向 2021-01-16 08:19

Hey I\'ve been trying to add Python 3.3 to windows powershell by repacing 27 with 33 in the path.

I tried to post a screenshot but turns out I need 10 rep so I\'ll j

2条回答
  •  清歌不尽
    2021-01-16 08:56

    The windows environment variable path is searched left to right. If the path to the 2.7 binaries is still in the variable, it will never find the 3.3 binaries, whose path you are appending to the end of the path variable.

    Also, you are not adding the path to PowerShell. The windows python binaries are what PowerShell considers legacy executables. What you are doing is telling the OS where executable binaries are. PowerShell knows how to use that info to execute those binaries without an absolute path. to do what you are looking to do in Powershell, try something like this

    $env:Path = ((($env:Path -split ";") | Where-Object { $_ -notlike "*Python*"}) -join ";") + ";C:\Python33"
    

    To make it persist, do this next

    [Environment]::SetEnvironmentVariable("Path",$env:Path, "User")
    

提交回复
热议问题