简体   繁体   中英

Python installation error: NumPy package

I am trying to follow this tutorial and getting an error when I do the following:

(DataVizProject) $ pip install -r requirements.txt

It gives me a big error log, the last few lines of which are :

C:\python\new-coder\dataviz\DataVizProj\build\numpy\numpy\distutils\system_info.
py:1422: UserWarning:

    Lapack (http://www.netlib.org/lapack/) sources not found.

    Directories to search for the sources can be specified in the

    numpy/distutils/site.cfg file (section [lapack_src]) or by setting

    the LAPACK_SRC environment variable.

  warnings.warn(LapackSrcNotFoundError.__doc__)

error: Unable to find vcvarsall.bat

----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in C:\python\new-coder
\dataviz\DataVizProj\build\numpy

I know it doesn't work because when I do the following steps:

>>> import numpy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named numpy
>>> import matplotlib
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named matplotlib
>>>

Thanks a lot!

@Hasnain, when you are using python in windows, eventually you will see this error for some packages.

You have three options when it happen (in order of relevance):

1 - Try to download a MSI file. It will install the library without any problems. To numpy specifically you can download here ( http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy )

2 - You can download the whole file and try a python setup.py install and modify the packacge if it raise some errors.

3 - You can compile your own library for your operational system.

Many MSI files you can find here ( http://www.lfd.uci.edu/~gohlke/pythonlibs/ )

The method recommended in that tutorial works well for Unix systems. If you are on Windows you will go through a lot of trouble trying to build numpy from sources with pip. I will save you some time, follow the official recomendation and try some binary install of the recommended ones in the official Scipy website . I personally recommend you the Anaconda or the Enthought distribution.

Usually when installing packages on windows, by default python searches for Visual Studio 2008 . You can either install it or use MinGW Compiler.

If you decide to use MinGW you should edit your distutils.cfg file in Python27\\Lib\\distutils directory :

[build]
compiler = mingw32

[build_ext]
compiler = mingw32

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM