Pip安装Keras - Command" python setup.py egg_info"

时间:2017-08-19 21:50:22

标签: python pip keras

我试图安装Keras但是有困难。我看过类似的线程并尝试了他们的解决方案,但似乎都没有。我尝试过以下方法:

pip install keras
pip install unroll 

返回的结果如下所示:

Command "python setup.py egg_info" failed with error code 1 in C:\Users\Ahmad\AppData\Local\Temp\pip-build-6qx6kw9h\unroll\

此处是我点击安装Keras时的输出:

C:\Users\Ahmad\Desktop\HouseProject>pip install keras
Collecting keras
Collecting theano (from keras)
Requirement already satisfied: pyyaml in     c:\users\ahmad\appdata\local\programs\python\python35\lib\site-packages (from keras)
Requirement already satisfied: six in c:\users\ahmad\appdata\local\programs\python\python35\lib\site-packages (from keras)
Collecting scipy>=0.14 (from theano->keras)
  Using cached scipy-0.19.1.tar.gz
    Complete output from command python setup.py egg_info:
    non-existing path in 'numpy\\distutils': 'site.cfg'
    Running from numpy source directory.
    C:\Users\Ahmad\AppData\Local\Temp\easy_install-3yj2htrd\numpy-    1.13.1\setup.py:367: UserWarning: Unrecognized setuptools command, proceeding     with generating Cython sources and expanding templates
      run_build = parse_setuppy_commands()
    C:\Users\Ahmad\AppData\Local\Temp\easy_install-3yj2htrd\numpy-    1.13.1\numpy\distutils\system_info.py:572: 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.
  self.calc_info()
    C:\Users\Ahmad\AppData\Local\Temp\easy_install-3yj2htrd\numpy-    1.13.1\numpy\distutils\system_info.py:572: 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.
  self.calc_info()
    C:\Users\Ahmad\AppData\Local\Temp\easy_install-3yj2htrd\numpy-1.13.1\numpy\distutils\system_info.py:572: 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.
      self.calc_info()
    C:\Users\Ahmad\AppData\Local\Temp\easy_install-3yj2htrd\numpy-    1.13.1\numpy\distutils\system_info.py:572: 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.
      self.calc_info()
    C:\Users\Ahmad\AppData\Local\Temp\easy_install-3yj2htrd\numpy-    1.13.1\numpy\distutils\system_info.py:572: 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.
      self.calc_info()
    c:\users\ahmad\appdata\local\programs\python\python35\lib\distutils\dist.py:261: UserWarning: Unknown distribution option: 'define_macros'
      warnings.warn(msg)
    Traceback (most recent call last):
      File "c:\users\ahmad\appdata\local\programs\python\python35\lib\site-    packages\setuptools\msvc.py", line 481, in _find_latest_available_vc_ver
        return self.find_available_vc_vers()[-1]
    IndexError: list index out of range

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File     "c:\users\ahmad\appdata\local\programs\python\python35\lib\distutils\core.py",     line 148, in setup
        dist.run_commands()
      File     "c:\users\ahmad\appdata\local\programs\python\python35\lib\distutils\dist.py",     line 955, in run_commands
        self.run_command(cmd)
      File     "c:\users\ahmad\appdata\local\programs\python\python35\lib\distutils\dist.py",     line 974, in run_command
        cmd_obj.run()
      File "c:\users\ahmad\appdata\local\programs\python\python35\lib\site-    packages\setuptools\command\bdist_egg.py", line 152, in run
        self.run_command("egg_info")
      File     "c:\users\ahmad\appdata\local\programs\python\python35\lib\distutils\cmd.py",     line 313, in run_command
        self.distribution.run_command(command)
      File     "c:\users\ahmad\appdata\local\programs\python\python35\lib\distutils\dist.py",     line 974, in run_command
        cmd_obj.run()
      File "C:\Users\Ahmad\AppData\Local\Temp\easy_install-3yj2htrd\numpy-    1.13.1\numpy\distutils\command\egg_info.py", line 26, in run
      File     "c:\users\ahmad\appdata\local\programs\python\python35\lib\distutils\cmd.py",     line 313, in run_command
        self.distribution.run_command(command)
      File     "c:\users\ahmad\appdata\local\programs\python\python35\lib\distutils\dist.py",     line 974, in run_command
        cmd_obj.run()
      File "C:\Users\Ahmad\AppData\Local\Temp\easy_install-3yj2htrd\numpy-    1.13.1\numpy\distutils\command\build_src.py", line 148, in run
      File "C:\Users\Ahmad\AppData\Local\Temp\easy_install-3yj2htrd\numpy-    1.13.1\numpy\distutils\command\build_src.py", line 159, in build_sources
      File "C:\Users\Ahmad\AppData\Local\Temp\easy_install-3yj2htrd\numpy-1.13.1\numpy\distutils\command\build_src.py", line 294, in build_library_sources
      File "C:\Users\Ahmad\AppData\Local\Temp\easy_install-3yj2htrd\numpy-1.13.1\numpy\distutils\command\build_src.py", line 377, in generate_sources
      File "numpy\core\setup.py", line 672, in get_mathlib_info
      File "c:\users\ahmad\appdata\local\programs\python\python35\lib\distutils\command\config.py", line 243, in try_link
        self._check_compiler()
      File "C:\Users\Ahmad\AppData\Local\Temp\easy_install-3yj2htrd\numpy-1.13.1\numpy\distutils\command\config.py", line 51, in _check_compiler
      File     "c:\users\ahmad\appdata\local\programs\python\python35\lib\distutils\_msvccompiler.py", line 197, in initialize
        vc_env = _get_vc_env(plat_spec)
      File "c:\users\ahmad\appdata\local\programs\python\python35\lib\site-    packages\setuptools\msvc.py", line 176, in msvc14_get_vc_env
        return EnvironmentInfo(plat_spec, vc_min_ver=14.0).return_env()
      File "c:\users\ahmad\appdata\local\programs\python\python35\lib\site-    packages\setuptools\msvc.py", line 835, in __init__
        self.si = SystemInfo(self.ri, vc_ver)
      File "c:\users\ahmad\appdata\local\programs\python\python35\lib\site-packages\setuptools\msvc.py", line 477, in __init__
        self.vc_ver = vc_ver or self._find_latest_available_vc_ver()
      File "c:\users\ahmad\appdata\local\programs\python\python35\lib\site-packages\setuptools\msvc.py", line 484, in _find_latest_available_vc_ver
        raise distutils.errors.DistutilsPlatformError(err)
    distutils.errors.DistutilsPlatformError: Microsoft Visual C++ 14.0 is     required. Get it with "Microsoft Visual C++ Build Tools":     http://landinghub.visualstudio.com/visual-cpp-build-tools

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "c:\users\ahmad\appdata\local\programs\python\python35\lib\site-packages\setuptools\sandbox.py", line 158, in save_modules
    yield saved
      File "c:\users\ahmad\appdata\local\programs\python\python35\lib\site-packages\setuptools\sandbox.py", line 199, in setup_context
    yield
      File "c:\users\ahmad\appdata\local\programs\python\python35\lib\site-packages\setuptools\sandbox.py", line 254, in run_setup
    _execfile(setup_script, ns)
      File "c:\users\ahmad\appdata\local\programs\python\python35\lib\site-packages\setuptools\sandbox.py", line 49, in _execfile
    exec(code, globals, locals)
      File "C:\Users\Ahmad\AppData\Local\Temp\easy_install-3yj2htrd\numpy-1.13.1\setup.py", line 392, in <module>
    # higher up in this file.
      File "C:\Users\Ahmad\AppData\Local\Temp\easy_install-3yj2htrd\numpy-1.13.1\setup.py", line 384, in setup_package
    if "--force" in sys.argv:
      File "C:\Users\Ahmad\AppData\Local\Temp\easy_install-3yj2htrd\numpy-1.13.1\numpy\distutils\core.py", line 169, in setup
  File "c:\users\ahmad\appdata\local\programs\python\python35\lib\distutils\core.py", line 163, in setup
        raise SystemExit("error: " + str(msg))
    SystemExit: error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "c:\users\ahmad\appdata\local\programs\python\python35\lib\site-packages\setuptools\command\easy_install.py", line 1104, in run_setup
    run_setup(setup_script, args)
      File "c:\users\ahmad\appdata\local\programs\python\python35\lib\site-packages\setuptools\sandbox.py", line 257, in run_setup
    raise
      File "c:\users\ahmad\appdata\local\programs\python\python35\lib\contextlib.py", line 77, in __exit__
    self.gen.throw(type, value, traceback)
      File "c:\users\ahmad\appdata\local\programs\python\python35\lib\site-packages\setuptools\sandbox.py", line 199, in setup_context
    yield
      File "c:\users\ahmad\appdata\local\programs\python\python35\lib\contextlib.py", line 77, in __exit__
    self.gen.throw(type, value, traceback)
  File "c:\users\ahmad\appdata\local\programs\python\python35\lib\site-packages\setuptools\sandbox.py", line 170, in save_modules
    saved_exc.resume()
  File "c:\users\ahmad\appdata\local\programs\python\python35\lib\site-packages\setuptools\sandbox.py", line 145, in resume
    six.reraise(type, exc, self._tb)
  File "c:\users\ahmad\appdata\local\programs\python\python35\lib\site-packages\pkg_resources\_vendor\six.py", line 685, in reraise
    raise value.with_traceback(tb)
  File "c:\users\ahmad\appdata\local\programs\python\python35\lib\site-packages\setuptools\sandbox.py", line 158, in save_modules
    yield saved
  File "c:\users\ahmad\appdata\local\programs\python\python35\lib\site-packages\setuptools\sandbox.py", line 199, in setup_context
    yield
  File "c:\users\ahmad\appdata\local\programs\python\python35\lib\site-packages\setuptools\sandbox.py", line 254, in run_setup
    _execfile(setup_script, ns)
  File "c:\users\ahmad\appdata\local\programs\python\python35\lib\site-packages\setuptools\sandbox.py", line 49, in _execfile
    exec(code, globals, locals)
  File "C:\Users\Ahmad\AppData\Local\Temp\easy_install-3yj2htrd\numpy-1.13.1\setup.py", line 392, in <module>
    # higher up in this file.
  File "C:\Users\Ahmad\AppData\Local\Temp\easy_install-3yj2htrd\numpy-1.13.1\setup.py", line 384, in setup_package
    if "--force" in sys.argv:
  File "C:\Users\Ahmad\AppData\Local\Temp\easy_install-3yj2htrd\numpy-1.13.1\numpy\distutils\core.py", line 169, in setup
  File "c:\users\ahmad\appdata\local\programs\python\python35\lib\distutils\core.py", line 163, in setup
    raise SystemExit("error: " + str(msg))
SystemExit: error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\Ahmad\AppData\Local\Temp\pip-build-xgjhugze\scipy\setup.py", line 416, in <module>
    setup_package()
  File "C:\Users\Ahmad\AppData\Local\Temp\pip-build-xgjhugze\scipy\setup.py", line 412, in setup_package
    setup(**metadata)
  File "c:\users\ahmad\appdata\local\programs\python\python35\lib\distutils\core.py", line 108, in setup
    _setup_distribution = dist = klass(attrs)
  File "c:\users\ahmad\appdata\local\programs\python\python35\lib\site-packages\setuptools\dist.py", line 325, in __init__
    self.fetch_build_eggs(attrs['setup_requires'])
  File "c:\users\ahmad\appdata\local\programs\python\python35\lib\site-packages\setuptools\dist.py", line 446, in fetch_build_eggs
    replace_conflicting=True,
  File "c:\users\ahmad\appdata\local\programs\python\python35\lib\site-packages\pkg_resources\__init__.py", line 855, in resolve
    dist = best[req.key] = env.best_match(req, ws, installer)
  File "c:\users\ahmad\appdata\local\programs\python\python35\lib\site-packages\pkg_resources\__init__.py", line 1127, in best_match
    return self.obtain(req, installer)
  File "c:\users\ahmad\appdata\local\programs\python\python35\lib\site-packages\pkg_resources\__init__.py", line 1139, in obtain
    return installer(requirement)
  File "c:\users\ahmad\appdata\local\programs\python\python35\lib\site-packages\setuptools\dist.py", line 518, in fetch_build_egg
    return cmd.easy_install(req)
  File "c:\users\ahmad\appdata\local\programs\python\python35\lib\site-packages\setuptools\command\easy_install.py", line 672, in easy_install
    return self.install_item(spec, dist.location, tmpdir, deps)
  File "c:\users\ahmad\appdata\local\programs\python\python35\lib\site-packages\setuptools\command\easy_install.py", line 698, in install_item
    dists = self.install_eggs(spec, download, tmpdir)
  File "c:\users\ahmad\appdata\local\programs\python\python35\lib\site-packages\setuptools\command\easy_install.py", line 879, in install_eggs
    return self.build_and_install(setup_script, setup_base)
  File "c:\users\ahmad\appdata\local\programs\python\python35\lib\site-packages\setuptools\command\easy_install.py", line 1118, in build_and_install
    self.run_setup(setup_script, setup_base, args)
  File "c:\users\ahmad\appdata\local\programs\python\python35\lib\site-packages\setuptools\command\easy_install.py", line 1106, in run_setup
    raise DistutilsError("Setup script exited with %s" % (v.args[0],))
distutils.errors.DistutilsError: Setup script exited with error: Microsoft     Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools":         http://landinghub.visualstudio.com/visual-cpp-build-tools

----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in 
C:\Users\Ahmad\AppData\Local\Temp\pip-build-xgjhugze\scipy\

我不知道这是否有帮助,但这是我的点子列表中的内容:

backports.weakref(1.0rc1)

beautifulsoup4(4.6.0)

漂白剂(1.5.0)

bs4(0.0.1)

certifi(2017.7.27.1)

chardet(3.0.4)

分发(0.7.3)

ez-setup(0.9)

html5lib(0.9999999)

idna(2.5)

变形(0.3.1)

Markdown(2.6.8)

more-itertools(3.2.0)

pandas(0.20.3)

pip(9.0.1)

protobuf(3.3.0)

python-dateutil(2.6.1)

pytz(2017.2)

PyYAML(3.12)

Quandl(3.2.0)

请求(2.17.3)

scikit-learn(0.18.2)

setuptools(36.2.7)

六(1.10.0)

sklearn(0.0)

tensorflow(1.2.1)

urllib3(1.21.1)

Werkzeug(0.12.2)

轮(0.29.0)

每当我再次安装Visual Studio时,我收到此错误。

Command "c:\users\ahmad\appdata\local\programs\python\python35\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Ahmad\\AppData\\Local\\Temp\\pip-build-si1p7x2k\\scipy\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\Ahmad\AppData\Local\Temp\pip-zrxmip_u-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\Ahmad\AppData\Local\Temp\pip-build-si1p7x2k\scipy\

感谢顺便帮忙!!

Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\Ahmad\AppData\Local\Temp\pip-build-si1p7x2k\scipy\setup.py", line 416, in <module>
        setup_package()
      File "C:\Users\Ahmad\AppData\Local\Temp\pip-build-si1p7x2k\scipy\setup.py", line 412, in setup_package
        setup(**metadata)
      File "c:\users\ahmad\appdata\local\programs\python\python35\lib\site-packages\numpy\distutils\core.py", line 135, in setup
        config = configuration()
      File "C:\Users\Ahmad\AppData\Local\Temp\pip-build-si1p7x2k\scipy\setup.py", line 336, in configuration
        config.add_subpackage('scipy')
      File "c:\users\ahmad\appdata\local\programs\python\python35\lib\site-packages\numpy\distutils\misc_util.py", line 1029, in add_subpackage
        caller_level = 2)
      File "c:\users\ahmad\appdata\local\programs\python\python35\lib\site-packages\numpy\distutils\misc_util.py", line 998, in get_subpackage
        caller_level = caller_level + 1)
      File "c:\users\ahmad\appdata\local\programs\python\python35\lib\site-packages\numpy\distutils\misc_util.py", line 935, in _get_configuration_from_setup_py
        config = setup_module.configuration(*args)
      File "scipy\setup.py", line 15, in configuration
        config.add_subpackage('linalg')
      File "c:\users\ahmad\appdata\local\programs\python\python35\lib\site-packages\numpy\distutils\misc_util.py", line 1029, in add_subpackage
        caller_level = 2)
      File "c:\users\ahmad\appdata\local\programs\python\python35\lib\site-packages\numpy\distutils\misc_util.py", line 998, in get_subpackage
        caller_level = caller_level + 1)
      File "c:\users\ahmad\appdata\local\programs\python\python35\lib\site-packages\numpy\distutils\misc_util.py", line 935, in _get_configuration_from_setup_py
        config = setup_module.configuration(*args)
      File "scipy\linalg\setup.py", line 20, in configuration
        raise NotFoundError('no lapack/blas resources found')
    numpy.distutils.system_info.NotFoundError: no lapack/blas resources found

1 个答案:

答案 0 :(得分:0)

我解决了这个问题......那是因为我没有使用anaconda。我使用anaconda卸载并重新安装,并且工作正常:)