【问题标题】:Python: Handling numpy, scipy and matplotlib dependencies in setup.pyPython:在 setup.py 中处理 numpy、scipy 和 matplotlib 依赖项
【发布时间】:2017-04-07 19:03:32
【问题描述】:

我有一个小项目使用:

import numpy as np
import _csv
from datetime import datetime, timedelta
from scipy.stats.stats import pearsonr
import matplotlib.pyplot as plt

所以我为它编写了一个简单的 setup.py:

from setuptools import setup, find_packages


setup(
    install_requires=['numpy', 'matplotlib', "scipy"]
)

当我运行 python setup.py install 我得到这个错误:

Searching for scipy
Reading https://pypi.python.org/simple/scipy/
Best match: scipy 0.19.0
Downloading https://pypi.python.org/packages/e5/93/9a8290e7eb5d4f7cb53b9a7ad7b92b9827ecceaddfd04c2a83f195d8767d/scipy-0.19.0.zip#md5=91b8396231eec780222a57703d3ec550
Processing scipy-0.19.0.zip
Writing /tmp/easy_install-EBVjVf/scipy-0.19.0/setup.cfg
Running scipy-0.19.0/setup.py -q bdist_egg --dist-dir /tmp/easy_install-EBVjVf/scipy-0.19.0/egg-dist-tmp-enWoYn
/tmp/easy_install-EBVjVf/scipy-0.19.0/setup.py:323: UserWarning: Unrecognized setuptools command, proceeding with generating Cython sources and expanding templates
  warnings.warn("Unrecognized setuptools command, proceeding with "
/usr/lib64/python2.7/site-packages/numpy/distutils/system_info.py:1408: 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__)
/usr/lib64/python2.7/site-packages/numpy/distutils/system_info.py:1419: 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__)
/usr/lib64/python2.7/site-packages/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__)
Warning: distutils distribution has been initialized, it may be too late to add an extension _vqWarning: distutils distribution has been initialized, it may be too late to add an extension _hierarchyWarning: distutils distribution has been initialized, it may be too late to add a subpackage clusterWarning: distutils distribution has been initialized, it may be too late to add a subpackage constantsWarning: distutils distribution has been initialized, it may be too late to add a library dfftpackWarning: distutils distribution has been initialized, it may be too late to add a library fftpackWarning: distutils distribution has been initialized, it may be too late to add an extension _fftpackWarning: distutils distribution has been initialized, it may be too late to add an extension convolveWarning: distutils distribution has been initialized, it may be too late to add a subpackage fftpackRunning from scipy source directory.
Warning: distutils distribution has been initialized, it may be too late to add a library machWarning: distutils distribution has been initialized, it may be too late to add a library quadpackWarning: distutils distribution has been initialized, it may be too late to add a library odepackWarning: distutils distribution has been initialized, it may be too late to add a library dopnon-existing path in 'scipy/integrate': 'quadpack.h'
Warning: distutils distribution has been initialized, it may be too late to add an extension _quadpackWarning: distutils distribution has been initialized, it may be too late to add an extension _odepackWarning: distutils distribution has been initialized, it may be too late to add an extension vodeWarning: distutils distribution has been initialized, it may be too late to add an extension lsodaWarning: distutils distribution has been initialized, it may be too late to add an extension _dopWarning: distutils distribution has been initialized, it may be too late to add an extension _test_multivariateWarning: distutils distribution has been initialized, it may be too late to add an extension _test_odeint_bandedWarning: distutils distribution has been initialized, it may be too late to add a subpackage integrateWarning: distutils distribution has been initialized, it may be too late to add a library fitpackWarning: distutils distribution has been initialized, it may be too late to add an extension interpndWarning: distutils distribution has been initialized, it may be too late to add an extension _ppolyWarning: distutils distribution has been initialized, it may be too late to add an extension _bsplWarning: distutils distribution has been initialized, it may be too late to add an extension _fitpackWarning: distutils distribution has been initialized, it may be too late to add an extension dfitpackWarning: distutils distribution has been initialized, it may be too late to add an extension _interpolateWarning: distutils distribution has been initialized, it may be too late to add a subpackage interpolateWarning: distutils distribution has been initialized, it may be too late to add an extension streamsWarning: distutils distribution has been initialized, it may be too late to add an extension mio_utilsWarning: distutils distribution has been initialized, it may be too late to add an extension mio5_utilsWarning: distutils distribution has been initialized, it may be too late to add a subpackage matlabWarning: distutils distribution has been initialized, it may be too late to add a subpackage arffWarning: distutils distribution has been initialized, it may be too late to add a subpackage harwell_boeingWarning: distutils distribution has been initialized, it may be too late to add a subpackage ioerror: no lapack/blas resources found

还有什么我应该添加到 setup.py 中的吗?

【问题讨论】:

    标签: python setuptools setup.py


    【解决方案1】:

    这似乎是缺少标题的问题。您可以尝试安装这些软件包:

    sudo apt-get install libatlas-dev liblapack-dev

    【讨论】:

    • 您也可以从 setup.py 的 main 函数中运行此命令
    猜你喜欢
    • 2015-01-17
    • 1970-01-01
    • 2016-10-18
    • 2014-05-03
    • 2014-11-03
    • 2015-02-05
    • 2012-05-21
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多