2015-10-05 190 views
1

我在Windows 10操作系統上安裝了Python 3。一切似乎都很好。我運行了一些tkinter程序,它們都工作正常。Python3安裝中缺少Numpy模塊

我現在想使用numpy模塊來完成一項任務,而我的娛樂我發現我已經安裝了Python中沒有Numpy模塊。

我瞭解到numpy模塊是一個基本的應用程序,它應該與python安裝一起提供。我對此是否正確?如果沒有,我現在怎麼安裝numpy?

我試着用PIP(pip install -U numpy)安裝在回答一個問題在計算器中的一個(3回答這個問題 - Installing SciPy with pip)的建議,但是當我做我得到一個錯誤:

atlas_3_10_blas_threads_info: 

Setting PTATLAS=ATLAS 

    libraries tatlas not found in ['C:\\Python34\\lib', 'C:\\', 'C:\\Python34\\libs'] 

    NOT AVAILABLE 



atlas_3_10_blas_info: 

    libraries satlas not found in ['C:\\Python34\\lib', 'C:\\', 'C:\\Python34\\libs'] 

    NOT AVAILABLE 



atlas_blas_threads_info: 

Setting PTATLAS=ATLAS 

    libraries ptf77blas,ptcblas,atlas not found in ['C:\\Python34\\lib', 'C:\\', 'C:\\Python34\\libs'] 

    NOT AVAILABLE 



atlas_blas_info: 

    libraries f77blas,cblas,atlas not found in ['C:\\Python34\\lib', 'C:\\', 'C:\\Python34\\libs'] 

    NOT AVAILABLE 



blas_info: 

    libraries blas not found in ['C:\\Python34\\lib', 'C:\\', 'C:\\Python34\\libs'] 

    NOT AVAILABLE 



blas_src_info: 

    NOT AVAILABLE 



    NOT AVAILABLE 



non-existing path in 'numpy\\lib': 'benchmarks' 

lapack_opt_info: 

openblas_lapack_info: 

    libraries openblas not found in ['C:\\Python34\\lib', 'C:\\', 'C:\\Python34\\libs'] 

    NOT AVAILABLE 



lapack_mkl_info: 

mkl_info: 

    libraries mkl,vml,guide not found in ['C:\\Python34\\lib', 'C:\\', 'C:\\Python34\\libs'] 

    NOT AVAILABLE 



    NOT AVAILABLE 



atlas_3_10_threads_info: 

Setting PTATLAS=ATLAS 

    libraries tatlas,tatlas not found in C:\Python34\lib 

    libraries lapack_atlas not found in C:\Python34\lib 

    libraries tatlas,tatlas not found in C:\ 

    libraries lapack_atlas not found in C:\ 

    libraries tatlas,tatlas not found in C:\Python34\libs 

    libraries lapack_atlas not found in C:\Python34\libs 

<class 'numpy.distutils.system_info.atlas_3_10_threads_info'> 

    NOT AVAILABLE 



atlas_3_10_info: 

    libraries satlas,satlas not found in C:\Python34\lib 

    libraries lapack_atlas not found in C:\Python34\lib 

    libraries satlas,satlas not found in C:\ 

    libraries lapack_atlas not found in C:\ 

    libraries satlas,satlas not found in C:\Python34\libs 

    libraries lapack_atlas not found in C:\Python34\libs 

<class 'numpy.distutils.system_info.atlas_3_10_info'> 

    NOT AVAILABLE 



atlas_threads_info: 

Setting PTATLAS=ATLAS 

    libraries ptf77blas,ptcblas,atlas not found in C:\Python34\lib 

    libraries lapack_atlas not found in C:\Python34\lib 

    libraries ptf77blas,ptcblas,atlas not found in C:\ 

    libraries lapack_atlas not found in C:\ 

    libraries ptf77blas,ptcblas,atlas not found in C:\Python34\libs 

    libraries lapack_atlas not found in C:\Python34\libs 

<class 'numpy.distutils.system_info.atlas_threads_info'> 

    NOT AVAILABLE 



atlas_info: 

    libraries f77blas,cblas,atlas not found in C:\Python34\lib 

    libraries lapack_atlas not found in C:\Python34\lib 

    libraries f77blas,cblas,atlas not found in C:\ 

    libraries lapack_atlas not found in C:\ 

    libraries f77blas,cblas,atlas not found in C:\Python34\libs 

    libraries lapack_atlas not found in C:\Python34\libs 

<class 'numpy.distutils.system_info.atlas_info'> 

    NOT AVAILABLE 



lapack_info: 

    libraries lapack not found in ['C:\\Python34\\lib', 'C:\\', 'C:\\Python34\\libs'] 

    NOT AVAILABLE 



lapack_src_info: 

    NOT AVAILABLE 



    NOT AVAILABLE 



running install 

running build 

running config_cc 

unifing config_cc, config, build_clib, build_ext, build commands --compiler options 

running config_fc 

unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options 

running build_src 

build_src 

building py_modules sources 

creating build 

creating build\src.win32-3.4 

creating build\src.win32-3.4\numpy 

creating build\src.win32-3.4\numpy\distutils 

building library "npymath" sources 

No module named 'numpy.distutils.msvccompiler' in numpy.distutils; trying from distutils 

Running from numpy source directory. 

C:\Users\Vasanth\AppData\Local\Temp\pip-build-6ru5zneo\numpy\numpy\distutils\system_info.py:1603: UserWarning: 

    Atlas (http://math-atlas.sourceforge.net/) libraries not found. 

    Directories to search for the libraries can be specified in the 

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

    the ATLAS environment variable. 

    warnings.warn(AtlasNotFoundError.__doc__) 

C:\Users\Vasanth\AppData\Local\Temp\pip-build-6ru5zneo\numpy\numpy\distutils\system_info.py:1612: UserWarning: 

    Blas (http://www.netlib.org/blas/) libraries not found. 

    Directories to search for the libraries can be specified in the 

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

    the BLAS environment variable. 

    warnings.warn(BlasNotFoundError.__doc__) 

C:\Users\Vasanth\AppData\Local\Temp\pip-build-6ru5zneo\numpy\numpy\distutils\system_info.py:1615: UserWarning: 

    Blas (http://www.netlib.org/blas/) sources not found. 

    Directories to search for the sources can be specified in the 

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

    the BLAS_SRC environment variable. 

    warnings.warn(BlasSrcNotFoundError.__doc__) 

C:\Users\Vasanth\AppData\Local\Temp\pip-build-6ru5zneo\numpy\numpy\distutils\system_info.py:1505: UserWarning: 

    Atlas (http://math-atlas.sourceforge.net/) libraries not found. 

    Directories to search for the libraries can be specified in the 

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

    the ATLAS environment variable. 

    warnings.warn(AtlasNotFoundError.__doc__) 

C:\Users\Vasanth\AppData\Local\Temp\pip-build-6ru5zneo\numpy\numpy\distutils\system_info.py:1516: UserWarning: 

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

    Directories to search for the libraries can be specified in the 

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

    the LAPACK environment variable. 

    warnings.warn(LapackNotFoundError.__doc__) 

C:\Users\Vasanth\AppData\Local\Temp\pip-build-6ru5zneo\numpy\numpy\distutils\system_info.py:1519: 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__) 

C:\Python34\lib\distutils\dist.py:260: UserWarning: Unknown distribution option: 'define_macros' 

    warnings.warn(msg) 

error: Microsoft Visual C++ 10.0 is required (Unable to find vcvarsall.bat). 

---------------------------------------- 
Command "C:\Python34\python.exe -c "import setuptools, tokenize;__file__='C:\\Users\\Vasanth\\AppData\\Local\\Temp\\pip-build-6ru5zneo\\numpy\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record C:\Users\Vasanth\AppData\Local\Temp\pip-ao3fi3xp-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\Vasanth\AppData\Local\Temp\pip-build-6ru5zneo\numpy 

回答

3

好正如你所看到的,你需要的Microsoft Visual C++:

error: Microsoft Visual C++ 10.0 is required (Unable to find vcvarsall.bat). 

這是因爲pip試圖編譯NumPy的。編譯軟件包可能並不那麼容易,特別是如果您使用的是Windows ...

但是有一種替代pip,您可能會發現非常方便:Conda

看一看的文檔,看看你可以輕鬆地:

  • 創建虛擬環境中使用你喜歡的Python解釋器。
  • 安裝已經編譯好的Python軟件包(當然包括NumPy)。
  • 安裝非科學Python包,這可能不需要編譯(用純Python編寫)。
+2

PS:不,Numpy目前不被認爲是「一個應該附帶python安裝的基本模塊」。它是一個特定於應用程序的模塊,不屬於Python編程語言。安裝需要在Windows上編譯的模塊時, – Peque

+1

存在很多問題。真的建議您嘗試Conda,因爲上面的答案可以節省您幾個小時的問題,並讓您使用適當的軟件包工作,從而使您可以使用不同的虛擬環境。 – Joop

+0

@Peque - 讓我試試conda。將回到這裏,一旦我已經安裝它,並已與它合作 –