4

I had python installed from the official Python.org installer but afterward I installed Anaconda. Now when running the script Powershell is not using Anaconda's version of Python but the previously installed version. I already changed the environment path but still the problem persists. How can I make Powershell to use Anaconda's version of Python?

8
  • Does your script have a shebang line? Commented Aug 18, 2015 at 15:05
  • What is exactly a shebang line? Commented Aug 18, 2015 at 15:08
  • Have you tried googling? In any case read here for an explanation. It was the first hit on google. Commented Aug 18, 2015 at 15:10
  • No, my script does not have a shebang line like this #! Commented Aug 18, 2015 at 15:12
  • 2
    What does get-command python.exe return? And ($env:Path).Replace(';',"`n")? Commented Aug 18, 2015 at 15:15

1 Answer 1

1

Fix the problem by changing the path directly on Powershell in which C:\Python27 is after C:\Anaconda;C:\Anaconda\Scripts. Check current path using:

(Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH).Path

And create a new path using:

$newPath=’Write new path’

Change to new path:

Set-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH –Value $newPath
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.