0

I recently downloaded Python(x,y) onto my machine (Windows 7), which included all the scientific computing libraries (numpy, scipy, etc). I am able to import numpy on IDLE and Spyder (the IDE provided by Python(x,y)) but cannot do it with Powershell. There error message is here: https://i.stack.imgur.com/IRBKk.jpg. The code I wrote with numpy works through IDLE and Spyder.

user217285
  • 346
  • 3
  • 16
  • I don't know Python(x,y) or use Windows, but this seems like a PATH issue; you need to get Python(x,y) on your PowerShell PATH. The reason it works in IDLE and Spyder is because they're already configured to work with Python(x,y). – Cyphase Aug 10 '15 at 06:10
  • That's what I had figured. My PATH variable is set to C:\Python27, and I can do normal python programming. What should I do next? – user217285 Aug 10 '15 at 06:13
  • Check $env:PSModulePath in PowerShell. – notjustme Aug 10 '15 at 06:20
  • I got: C:\Users\(my name)\Documents\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modules\ – user217285 Aug 10 '15 at 06:22
  • You probably have 2 python installations on your computer, and the one in your `PATH` variable is not `Python(x, y)` but a standard python installation located at `C:\Python27`. You should remove `C:\Python27` from your `PATH` and instead add the installation directory of your `Python(x, y)` installation (or wherever the python executable of `Python(x, y)` is located). – Holt Aug 10 '15 at 07:20
  • that's odd. I also use python(x,y) and can import pylab in powershell just fine. Python(x,y) installs python into C:\Python27 anyway and from your screenshot, you are indeed using pyhton in C:\Python27 so the path seems ok. Maybe do you want to try IPython Qt console that comes with Python(x,y)? IMHO it's better than IDLE or PowerShell. – otterb Aug 10 '15 at 16:21
  • [This stackoverflow answer](https://stackoverflow.com/a/39814710/2992902) resolved my issue in Windows 10 using Powershell – Lokesh Oct 07 '20 at 14:24

1 Answers1

0

I turned my computer on and off and it works. Go figure.

user217285
  • 346
  • 3
  • 16