当前位置: 首页 > 知识库问答 >
问题:

如何使用setuptools安装scipy和numpy

狄富
2023-03-14

我正在开发一个Python3.4模块,它依赖于scipy和numpy。所以我在设置中声明了它们。py在install_下需要。

下面是我的设置的最低运行示例。派克

from setuptools import setup

setup(
        name='MyModule',
        version='1.0.5',
        author='Alexander Mueller',
        packages=[],
        scripts=[],
        license='LICENSE.txt',
        description='Stuff',
        install_requires=[
            "pandas == 0.15.2",
            "scikit-learn==0.17",
            "seaborn == 0.5.1",
            "scipy == 0.17.0",
            "numpy==1.10.4"
        ]
)

在运行python安装程序时。py安装发生以下异常。

然而,当我按照pip安装的顺序安装所有这些包时,根本不会发生错误。可能easy_install问题?

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "setup.py", line 16, in <module>
    "numpy==1.10.4"
  File "/usr/local/Cellar/python3/3.4.3_2/Frameworks/Python.framework/Versions/3.4/lib/python3.4/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/usr/local/Cellar/python3/3.4.3_2/Frameworks/Python.framework/Versions/3.4/lib/python3.4/distutils/dist.py", line 955, in run_commands
    self.run_command(cmd)
  File "/usr/local/Cellar/python3/3.4.3_2/Frameworks/Python.framework/Versions/3.4/lib/python3.4/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "/Users/alexandermueller/.virtualenvs/fpm_test3/lib/python3.4/site-packages/setuptools/command/install.py", line 67, in run
    self.do_egg_install()
  File "/Users/alexandermueller/.virtualenvs/fpm_test3/lib/python3.4/site-packages/setuptools/command/install.py", line 117, in do_egg_install
    cmd.run()
  File "/Users/alexandermueller/.virtualenvs/fpm_test3/lib/python3.4/site-packages/setuptools/command/easy_install.py", line 380, in run
    self.easy_install(spec, not self.no_deps)
  File "/Users/alexandermueller/.virtualenvs/fpm_test3/lib/python3.4/site-packages/setuptools/command/easy_install.py", line 610, in easy_install
    return self.install_item(None, spec, tmpdir, deps, True)
  File "/Users/alexandermueller/.virtualenvs/fpm_test3/lib/python3.4/site-packages/setuptools/command/easy_install.py", line 661, in install_item
    self.process_distribution(spec, dist, deps)
  File "/Users/alexandermueller/.virtualenvs/fpm_test3/lib/python3.4/site-packages/setuptools/command/easy_install.py", line 709, in process_distribution
    [requirement], self.local_index, self.easy_install
  File "/Users/alexandermueller/.virtualenvs/fpm_test3/lib/python3.4/site-packages/pkg_resources/__init__.py", line 830, in resolve
    dist = best[req.key] = env.best_match(req, ws, installer)
  File "/Users/alexandermueller/.virtualenvs/fpm_test3/lib/python3.4/site-packages/pkg_resources/__init__.py", line 1075, in best_match
    return self.obtain(req, installer)
  File "/Users/alexandermueller/.virtualenvs/fpm_test3/lib/python3.4/site-packages/pkg_resources/__init__.py", line 1087, in obtain
    return installer(requirement)
  File "/Users/alexandermueller/.virtualenvs/fpm_test3/lib/python3.4/site-packages/setuptools/command/easy_install.py", line 629, in easy_install
    return self.install_item(spec, dist.location, tmpdir, deps)
  File "/Users/alexandermueller/.virtualenvs/fpm_test3/lib/python3.4/site-packages/setuptools/command/easy_install.py", line 659, in install_item
    dists = self.install_eggs(spec, download, tmpdir)
  File "/Users/alexandermueller/.virtualenvs/fpm_test3/lib/python3.4/site-packages/setuptools/command/easy_install.py", line 842, in install_eggs
    return self.build_and_install(setup_script, setup_base)
  File "/Users/alexandermueller/.virtualenvs/fpm_test3/lib/python3.4/site-packages/setuptools/command/easy_install.py", line 1070, in build_and_install
    self.run_setup(setup_script, setup_base, args)
  File "/Users/alexandermueller/.virtualenvs/fpm_test3/lib/python3.4/site-packages/setuptools/command/easy_install.py", line 1056, in run_setup
    run_setup(setup_script, args)
  File "/Users/alexandermueller/.virtualenvs/fpm_test3/lib/python3.4/site-packages/setuptools/sandbox.py", line 240, in run_setup
    raise
  File "/usr/local/Cellar/python3/3.4.3_2/Frameworks/Python.framework/Versions/3.4/lib/python3.4/contextlib.py", line 77, in __exit__
    self.gen.throw(type, value, traceback)
  File "/Users/alexandermueller/.virtualenvs/fpm_test3/lib/python3.4/site-packages/setuptools/sandbox.py", line 193, in setup_context
    yield
  File "/usr/local/Cellar/python3/3.4.3_2/Frameworks/Python.framework/Versions/3.4/lib/python3.4/contextlib.py", line 77, in __exit__
    self.gen.throw(type, value, traceback)
  File "/Users/alexandermueller/.virtualenvs/fpm_test3/lib/python3.4/site-packages/setuptools/sandbox.py", line 164, in save_modules
    saved_exc.resume()
  File "/Users/alexandermueller/.virtualenvs/fpm_test3/lib/python3.4/site-packages/setuptools/sandbox.py", line 139, in resume
    compat.reraise(type, exc, self._tb)
  File "/Users/alexandermueller/.virtualenvs/fpm_test3/lib/python3.4/site-packages/setuptools/compat.py", line 65, in reraise
    raise value.with_traceback(tb)
  File "/Users/alexandermueller/.virtualenvs/fpm_test3/lib/python3.4/site-packages/setuptools/sandbox.py", line 152, in save_modules
    yield saved
  File "/Users/alexandermueller/.virtualenvs/fpm_test3/lib/python3.4/site-packages/setuptools/sandbox.py", line 193, in setup_context
    yield
  File "/Users/alexandermueller/.virtualenvs/fpm_test3/lib/python3.4/site-packages/setuptools/sandbox.py", line 237, in run_setup
    DirectorySandbox(setup_dir).run(runner)
  File "/Users/alexandermueller/.virtualenvs/fpm_test3/lib/python3.4/site-packages/setuptools/sandbox.py", line 267, in run
    return func()
  File "/Users/alexandermueller/.virtualenvs/fpm_test3/lib/python3.4/site-packages/setuptools/sandbox.py", line 236, in runner
    _execfile(setup_script, ns)
  File "/Users/alexandermueller/.virtualenvs/fpm_test3/lib/python3.4/site-packages/setuptools/sandbox.py", line 46, in _execfile
    exec(code, globals, locals)
  File "/var/folders/b0/_y4bfk6x4bldrmtycxhmbtrm0000gn/T/easy_install-drrk1iwn/scipy-0.17.0/setup.py", line 265, in <module>
  File "/var/folders/b0/_y4bfk6x4bldrmtycxhmbtrm0000gn/T/easy_install-drrk1iwn/scipy-0.17.0/setup.py", line 253, in setup_package
ImportError: No module named 'numpy'

提前谢谢你们。

共有1个答案

仲和韵
2023-03-14

订单在这里似乎很重要,使用此订单安装了所需的软件包

install_requires=[
            "numpy == 1.10.4",
            "pandas == 0.15.2",
            "seaborn == 0.5.1",
            "scipy == 0.17.0",
            "scikit-learn == 0.17"
        ]

使用pip3 1.5进行测试。4、徐邦图14.04

 类似资料:
  • 我试图在我正在分发的包中创建所需的库。它需要SciPy和NumPy库。在开发过程中,我使用 它安装了SciPy 0.9。0和NumPy 1.5。1,而且效果很好。 我想使用-执行同样的操作,以便能够在设置中指定依赖项。我自己的包裹。 问题是,当我尝试时: 它很好用。 但是 惨败 我如何让它工作?

  • 问题内容: 我正在尝试在要分发的程序包中创建所需的库。它需要SciPy和NumPy库。在开发过程中,我同时使用 它安装了SciPy 0.9.0和NumPy 1.5.1,并且运行良好。 我想使用-做同样的事情,以便能够在我自己的包的setup.py中指定依赖项。 问题是,当我尝试: 它工作正常。 但是之后 惨败 我该如何工作? 问题答案: 我假设我的回答是Linux经验。我发现要顺利进行有三个先决条

  • 问题内容: 它可以安装NumPy的与PIP使用。 SciPy是否有类似的可能性?(这样做无效。) 更新资料 SciPy软件包现在可用于安装! 问题答案: 试图指出其在Python Package Index中 列出的问题,该点会进行搜索。 但是,一切并没有丢失。可以从Subversion(SVN),Git,Mercurial和Bazaar存储库安装。SciPy使用SVN: 更新(12-2012):

  • 问题内容: 我认为这是最流行的方式: https://pytools.codeplex.com/wikipage?title=NumPy%20and%20SciPy%20for%20.Net 但是此链接不再存在: https://store.enthought.com/repo/.iron/ 我最近找到了该指令的克隆,还在github上找到了ironpkg-1.0.0.py的克隆。 但是,互联网上

  • 问题内容: 如何在系统上安装SciPy? 对于NumPy部分(SciPy依赖),实际上有一个64位Windows安装程序:numpy-1.3.0.win- amd64-py2.6.msi (直接下载URL,2310144字节)。 运行SciPy superpack安装程序会在对话框中显示以下消息: 无法安装。需要python版本2.6,在注册表中找不到该版本。 我已经安装了Python 2.6.2

  • 我已经安装了Apache server 2.4和Ant 1.8.3,下载了Velocity 1.7和Velocity tools 2.0。我已经阅读了大约十次Apache Velocity的安装文档,并在谷歌上搜索了两天,但我仍然不知道如何处理这些文件。谁能提供一个详细的描述如何安装速度请? 我希望使用Eclipse进行开发,所以我也安装了这个。 如果我被困住了,我会很感激任何帮助。 谢谢你。