2

I have a question which is very similar to Import Error: No module named numpy but the answer to that question I do not believe would be appropriate for me, so I'm asking again.

importerror cmd

This is my most recent effort after about six hours of trying to get modules to work in python (numpy is a dependency of something else), so I'm finally turning to SO. Part of efforts in the last six hours included installing the enthought distribution, as its large volume of libraries was highly advised for windows users. I've even thrown the location of numpy folder onto the path of environment variables just to exclude it as a possibility.

Windows, 64bit, Python 2.7

Community
  • 1
  • 1
Stumbler
  • 2,056
  • 7
  • 35
  • 61
  • Not a solution, but a recommendation: Always use virtual environments, with `virtualenv` or `mkvirtualenv`. – Apalala Feb 12 '17 at 17:03
  • Make sure that the pip line and the python line use the same python version. – Andras Deak -- Слава Україні Feb 12 '17 at 17:03
  • @AndrasDeak okay: sounds possible. Any idea how I might do that? – Stumbler Feb 12 '17 at 17:11
  • @Apalala surely if the non-virtual environment is this tortuous to setup, the virtual one would be even more difficult (even if the virtual one made life easier, going forward). – Stumbler Feb 12 '17 at 17:12
  • Well, I don't know the windows syntax, but in linux we have `python -V` and `pip -V`. Otherwise I think you can use `python -m pip [...]` which hopefully uses the same `python`. Unfortunately all I know about installing python on windows is that it's not always trivial. – Andras Deak -- Слава Україні Feb 12 '17 at 17:13
  • 1
    @Stumbler Everything gets to play with the main Python environment. A virtual one is isolated, and minimal, and will use the versions of `python`, tools and libreares specified. – Apalala Feb 12 '17 at 17:16
  • 1
    @AndrasDeak okay, it's fairly similar in windows. pip cites enthought distribution directory (python 2.7) while python version says specifically 2.7.9 ... so I doubt there's a conflict at that end... – Stumbler Feb 12 '17 at 17:17

2 Answers2

1

Since you are on windows, I highly recommend that you install ANACONDA. This way the environment variables are set automatically and you don't need to worry about anything else. There are many useful packages (e.g. numpy, sympy, scipy) which are bundled with anaconda.

Moreover, based on personal experience I can tell you that using pip on windows and compiling from source (you need visual studio) is a pain in the neck sometimes. That's why ANACONDA has been conceived.

Hope this helps.

DRPK
  • 2,023
  • 1
  • 14
  • 27
  • Okay... half way there... Anaconda knows what numpy is... but python scripts in general still don't. Hmm – Stumbler Feb 12 '17 at 18:00
  • 1
    ... and removing all trace of python27 in system environment variables while ensuring that anaconda is on user environment variables seems to have sorted that out. Christ what a mess of a language. – Stumbler Feb 12 '17 at 18:28
  • this is not an answer. THIS IS AN ALTERNATIVE! – greendino Mar 20 '20 at 08:54
1

For python versions > 3.4 ,do this pip install numpy beacuse pip is python dependency which installs packages just like npm in js i.e. node.js

Meet Zaveri
  • 2,921
  • 1
  • 22
  • 33