gpt4 book ai didi

Python:在 setup.py 中处理 numpy、scipy 和 matplotlib 依赖项

转载 作者:太空宇宙 更新时间:2023-11-03 15:23:57 24 4
gpt4 key购买 nike

我有一个小项目,使用:

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 中添加其他内容吗?

最佳答案

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

sudo apt-get install libatlas-dev liblapack-dev

关于Python:在 setup.py 中处理 numpy、scipy 和 matplotlib 依赖项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43285373/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com