Numpy 不安装 [英] Numpy Does Not Install

查看:78
本文介绍了Numpy 不安装的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我基本上是在尝试安装 Pandas,但要做到这一点,我应该安装 Numpy.

I’m basically trying to install Pandas, but to do that I’m supposedly supposed to be installing Numpy.

我在终端中输入:

pip 安装 numpy

pip install numpy

我收到一个错误,基本上说我需要 Microsoft Visual Studio C++ 14.0.从它提供的链接下载后,我完全不知道如何使用它.我曾尝试使用 YouTube 教程来了解如何使用 Visual Studio,但是当他们创建项目时,我没有任何选择.我唯一的选择是创建一个空白的解决方案.

And I get an error which basically says I need Microsoft Visual Studio C++ 14.0. After I downloaded it from the link it provided, I have absolutely no idea how to work with it. I’ve tried to use a YouTube tutorial on how to use Visual Studio, but when they create a project I don’t have any of their options. The only option I have is to create a blank solution.

如果其余的错误消息是必要的,请提醒我,我才开始使用 Python 几个月,所以我不是很有经验.

If the rest of the error message is necessary please alert me of that, I’ve only started to work with Python for a couple months, so I’m not very experienced.

错误信息:

(venv) C:\Users\pc\PycharmProjects\Tutorials>pip install numpy
Collecting numpy
  Using cached https://files.pythonhosted.org/packages/84/1e/ff467ac56bfeaea51d4a2e72d315c1fe440b20192fea7e460f0f248acac8/numpy-1.18.2.zip
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... error
    Complete output from command C:\Users\pc\PycharmProjects\Tutorials\venv\Scripts\python.exe C:\Users\pc\PycharmProjects\Tutorials\venv\lib\site-packages\pip-19.0.3-py3.8.egg\pip\_vendor\pep517\_in_process.py prepare_meta
data_for_build_wheel C:\Users\pc\AppData\Local\Temp\tmp7lo0j8qw:
    Processing numpy/random\_bounded_integers.pxd.in
    Processing numpy/random\mtrand.pyx
    Processing numpy/random\_bit_generator.pyx
    Processing numpy/random\_bounded_integers.pyx.in
    Processing numpy/random\_common.pyx
    Processing numpy/random\_generator.pyx
    Processing numpy/random\_mt19937.pyx
    Processing numpy/random\_pcg64.pyx
    Processing numpy/random\_philox.pyx
    Processing numpy/random\_sfc64.pyx
    Cythonizing sources
    blas_opt_info:
    blas_mkl_info:
    No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
    customize MSVCCompiler
      libraries mkl_rt not found in ['C:\\Users\\pc\\PycharmProjects\\Tutorials\\venv\\lib', 'C:\\']
      NOT AVAILABLE

    blis_info:
      libraries blis not found in ['C:\\Users\\pc\\PycharmProjects\\Tutorials\\venv\\lib', 'C:\\']
      NOT AVAILABLE

    openblas_info:
      libraries openblas not found in ['C:\\Users\\pc\\PycharmProjects\\Tutorials\\venv\\lib', 'C:\\']
    get_default_fcompiler: matching types: '['gnu', 'intelv', 'absoft', 'compaqv', 'intelev', 'gnu95', 'g95', 'intelvem', 'intelem', 'flang']'
    customize GnuFCompiler
    Could not locate executable g77
    Could not locate executable f77
    customize IntelVisualFCompiler
    Could not locate executable ifort
    Could not locate executable ifl
    customize AbsoftFCompiler
    Could not locate executable f90
    customize CompaqVisualFCompiler
    Could not locate executable DF
    customize IntelItaniumVisualFCompiler
    Could not locate executable efl
    customize Gnu95FCompiler
    Could not locate executable gfortran
    Could not locate executable f95
    customize G95FCompiler
    Could not locate executable g95
    customize IntelEM64VisualFCompiler
    customize IntelEM64TFCompiler
    Could not locate executable efort
    Could not locate executable efc
    customize PGroupFlangCompiler
    Could not locate executable flang
    don't know how to compile Fortran code on platform 'nt'
      NOT AVAILABLE

    atlas_3_10_blas_threads_info:
    Setting PTATLAS=ATLAS
      libraries tatlas not found in ['C:\\Users\\pc\\PycharmProjects\\Tutorials\\venv\\lib', 'C:\\']
      NOT AVAILABLE

    atlas_3_10_blas_info:
      libraries satlas not found in ['C:\\Users\\pc\\PycharmProjects\\Tutorials\\venv\\lib', 'C:\\']
      NOT AVAILABLE

    atlas_blas_threads_info:
    Setting PTATLAS=ATLAS
      libraries ptf77blas,ptcblas,atlas not found in ['C:\\Users\\pc\\PycharmProjects\\Tutorials\\venv\\lib', 'C:\\']
      NOT AVAILABLE

    atlas_blas_info:
      libraries f77blas,cblas,atlas not found in ['C:\\Users\\pc\\PycharmProjects\\Tutorials\\venv\\lib', 'C:\\']
      NOT AVAILABLE

    accelerate_info:
      NOT AVAILABLE

    blas_info:
      libraries blas not found in ['C:\\Users\\pc\\PycharmProjects\\Tutorials\\venv\\lib', 'C:\\']
      NOT AVAILABLE

    blas_src_info:
      NOT AVAILABLE

      NOT AVAILABLE

    non-existing path in 'numpy\\distutils': 'site.cfg'
    lapack_opt_info:
    lapack_mkl_info:
      libraries mkl_rt not found in ['C:\\Users\\pc\\PycharmProjects\\Tutorials\\venv\\lib', 'C:\\']
      NOT AVAILABLE

    openblas_lapack_info:
      libraries openblas not found in ['C:\\Users\\pc\\PycharmProjects\\Tutorials\\venv\\lib', 'C:\\']
      NOT AVAILABLE

    openblas_clapack_info:
      libraries openblas,lapack not found in ['C:\\Users\\pc\\PycharmProjects\\Tutorials\\venv\\lib', 'C:\\']
      NOT AVAILABLE

    flame_info:
      libraries flame not found in ['C:\\Users\\pc\\PycharmProjects\\Tutorials\\venv\\lib', 'C:\\']
      NOT AVAILABLE

    atlas_3_10_threads_info:
    Setting PTATLAS=ATLAS
      libraries lapack_atlas not found in C:\Users\pc\PycharmProjects\Tutorials\venv\lib
      libraries tatlas,tatlas not found in C:\Users\pc\PycharmProjects\Tutorials\venv\lib
      libraries lapack_atlas not found in C:\
      libraries tatlas,tatlas not found in C:\
    <class 'numpy.distutils.system_info.atlas_3_10_threads_info'>
      NOT AVAILABLE

    atlas_3_10_info:
      libraries lapack_atlas not found in C:\Users\pc\PycharmProjects\Tutorials\venv\lib
      libraries satlas,satlas not found in C:\Users\pc\PycharmProjects\Tutorials\venv\lib
      libraries lapack_atlas not found in C:\
      libraries satlas,satlas not found in C:\
    <class 'numpy.distutils.system_info.atlas_3_10_info'>
      NOT AVAILABLE

    atlas_threads_info:
    Setting PTATLAS=ATLAS
      libraries lapack_atlas not found in C:\Users\pc\PycharmProjects\Tutorials\venv\lib
      libraries ptf77blas,ptcblas,atlas not found in C:\Users\pc\PycharmProjects\Tutorials\venv\lib
      libraries lapack_atlas not found in C:\
      libraries ptf77blas,ptcblas,atlas not found in C:\
    <class 'numpy.distutils.system_info.atlas_threads_info'>
      NOT AVAILABLE

    atlas_info:
      libraries lapack_atlas not found in C:\Users\pc\PycharmProjects\Tutorials\venv\lib
      libraries f77blas,cblas,atlas not found in C:\Users\pc\PycharmProjects\Tutorials\venv\lib
      libraries lapack_atlas not found in C:\
      libraries f77blas,cblas,atlas not found in C:\
    <class 'numpy.distutils.system_info.atlas_info'>
      NOT AVAILABLE

    lapack_info:
      libraries lapack not found in ['C:\\Users\\pc\\PycharmProjects\\Tutorials\\venv\\lib', 'C:\\']
      NOT AVAILABLE

    lapack_src_info:
      NOT AVAILABLE

      NOT AVAILABLE

    running dist_info
    running build_src
    build_src
    building py_modules sources
    creating build
    creating build\src.win-amd64-3.8
    creating build\src.win-amd64-3.8\numpy
    creating build\src.win-amd64-3.8\numpy\distutils
    building library "npymath" sources
    Running from numpy source directory.
    setup.py:461: UserWarning: Unrecognized setuptools command, proceeding with generating Cython sources and expanding templates
      run_build = parse_setuppy_commands()
    C:\Users\pc\AppData\Local\Temp\pip-install-az7mvo02\numpy\numpy\distutils\system_info.py:1896: UserWarning:
        Optimized (vendor) Blas libraries are not found.
        Falls back to netlib Blas library which has worse performance.
        A better performance should be easily gained by switching
        Blas library.
      if self._calc_info(blas):
    C:\Users\pc\AppData\Local\Temp\pip-install-az7mvo02\numpy\numpy\distutils\system_info.py:1896: 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.
      if self._calc_info(blas):
    C:\Users\pc\AppData\Local\Temp\pip-install-az7mvo02\numpy\numpy\distutils\system_info.py:1896: 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.
      if self._calc_info(blas):
    C:\Users\pc\AppData\Local\Temp\pip-install-az7mvo02\numpy\numpy\distutils\system_info.py:1730: 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.
      return getattr(self, '_calc_info_{}'.format(name))()
    C:\Users\pc\AppData\Local\Temp\pip-install-az7mvo02\numpy\numpy\distutils\system_info.py:1730: 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.
      return getattr(self, '_calc_info_{}'.format(name))()
    C:\Users\pc\AppData\Local\Programs\Python\Python38\lib\distutils\dist.py:274: UserWarning: Unknown distribution option: 'define_macros'
      warnings.warn(msg)
    error: Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://visualstudio.microsoft.com/downloads/

    ----------------------------------------
Command "C:\Users\pc\PycharmProjects\Tutorials\venv\Scripts\python.exe C:\Users\pc\PycharmProjects\Tutorials\venv\lib\site-packages\pip-19.0.3-py3.8.egg\pip\_vendor\pep517\_in_process.py prepare_metadata_for_build_wheel C:\
Users\pc\AppData\Local\Temp\tmp7lo0j8qw" failed with error code 1 in C:\Users\pc\AppData\Local\Temp\pip-install-az7mvo02\numpy

升级 pip 时出错:

Error when upgrading pip:

(venv) C:\Users\pc\PycharmProjects\Tutorials>python -m pip install --upgrade pip
Collecting pip
  Downloading https://files.pythonhosted.org/packages/54/0c/d01aa759fdc501a58f431eb594a17495f15b88da142ce14b5845662c13f3/pip-20.0.2-py2.py3-none-any.whl (1.4MB)
    100% |████████████████████████████████| 1.4MB 2.2MB/s
Installing collected packages: pip
  Found existing installation: pip 19.0.3
    Uninstalling pip-19.0.3:
      Successfully uninstalled pip-19.0.3
  Rolling back uninstall of pip
  Moving to c:\users\pc\pycharmprojects\tutorials\venv\lib\site-packages\pip-19.0.3-py3.8.egg
   from C:\Users\pc\PycharmProjects\Tutorials\venv\Lib\site-packages\~ip-19.0.3-py3.8.egg
  Moving to c:\users\pc\pycharmprojects\tutorials\venv\scripts\pip-script.py
   from C:\Users\pc\AppData\Local\Temp\pip-uninstall-hqx4h1fb\pip-script.py
  Moving to c:\users\pc\pycharmprojects\tutorials\venv\scripts\pip.exe
   from C:\Users\pc\AppData\Local\Temp\pip-uninstall-hqx4h1fb\pip.exe
  Moving to c:\users\pc\pycharmprojects\tutorials\venv\scripts\pip3-script.py
   from C:\Users\pc\AppData\Local\Temp\pip-uninstall-hqx4h1fb\pip3-script.py
  Moving to c:\users\pc\pycharmprojects\tutorials\venv\scripts\pip3.8-script.py
   from C:\Users\pc\AppData\Local\Temp\pip-uninstall-hqx4h1fb\pip3.8-script.py
  Moving to c:\users\pc\pycharmprojects\tutorials\venv\scripts\pip3.8.exe
   from C:\Users\pc\AppData\Local\Temp\pip-uninstall-hqx4h1fb\pip3.8.exe
  Moving to c:\users\pc\pycharmprojects\tutorials\venv\scripts\pip3.exe
   from C:\Users\pc\AppData\Local\Temp\pip-uninstall-hqx4h1fb\pip3.exe
Exception:
Traceback (most recent call last):
  File "C:\Users\pc\PycharmProjects\Tutorials\venv\lib\site-packages\pip-19.0.3-py3.8.egg\pip\_internal\cli\base_command.py", line 179, in main
    status = self.run(options, args)
  File "C:\Users\pc\PycharmProjects\Tutorials\venv\lib\site-packages\pip-19.0.3-py3.8.egg\pip\_internal\commands\install.py", line 384, in run
    installed = install_given_reqs(
  File "C:\Users\pc\PycharmProjects\Tutorials\venv\lib\site-packages\pip-19.0.3-py3.8.egg\pip\_internal\req\__init__.py", line 53, in install_given_reqs
    requirement.install(
  File "C:\Users\pc\PycharmProjects\Tutorials\venv\lib\site-packages\pip-19.0.3-py3.8.egg\pip\_internal\req\req_install.py", line 910, in install
    self.move_wheel_files(
  File "C:\Users\pc\PycharmProjects\Tutorials\venv\lib\site-packages\pip-19.0.3-py3.8.egg\pip\_internal\req\req_install.py", line 437, in move_wheel_files
    move_wheel_files(
  File "C:\Users\pc\PycharmProjects\Tutorials\venv\lib\site-packages\pip-19.0.3-py3.8.egg\pip\_internal\wheel.py", line 544, in move_wheel_files
    generated.extend(maker.make(spec))
  File "C:\Users\pc\PycharmProjects\Tutorials\venv\lib\site-packages\pip-19.0.3-py3.8.egg\pip\_vendor\distlib\scripts.py", line 405, in make
    self._make_script(entry, filenames, options=options)
  File "C:\Users\pc\PycharmProjects\Tutorials\venv\lib\site-packages\pip-19.0.3-py3.8.egg\pip\_vendor\distlib\scripts.py", line 309, in _make_script
    self._write_script(scriptnames, shebang, script, filenames, ext)
  File "C:\Users\pc\PycharmProjects\Tutorials\venv\lib\site-packages\pip-19.0.3-py3.8.egg\pip\_vendor\distlib\scripts.py", line 245, in _write_script
    launcher = self._get_launcher('t')
  File "C:\Users\pc\PycharmProjects\Tutorials\venv\lib\site-packages\pip-19.0.3-py3.8.egg\pip\_vendor\distlib\scripts.py", line 384, in _get_launcher
    result = finder(distlib_package).find(name).bytes
AttributeError: 'NoneType' object has no attribute 'bytes'

推荐答案

有几个选择:

1) 从 Python 扩展包的非官方 Windows 二进制文件下载二进制文件

1) Download the Binary from Unofficial Windows Binaries for Python Extension Packages

对于不提供自己的 Windows 安装程序的项目(和甚至有些人这样做),加利福尼亚大学的 Christoph Gohlke提供了一组 Windows 安装程序.许多 Python 用户在Windows 报告了这些预构建的积极体验版本.来源

For projects which don’t provide their own Windows installers (and even some which do), Christoph Gohlke at the University of California provides a collection of Windows installers. Many Python users on Windows have reported a positive experience with these prebuilt versions. Source

https://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy

搜索和下载:

numpy-1.18.2+mkl-cp38-cp38-win_amd64.whl

numpy‑1.18.2+mkl‑cp38‑cp38‑win_amd64.whl

打开终端,激活您的 env,然后安装(更改文件下载的路径):

Open terminal, activate your env, and install (change the path to where file downloaded):

pip install C:\Users\pc\downloads\numpy‑1.18.2+mkl‑cp38‑cp38‑win_amd64.whl

2) 由于您使用的是 Windows(就像我一样),我强烈建议您利用 Anaconda 分布的 Python.从长远来看,将为您节省大量时间.基本上,它安装二进制包,而不是要求您使用 pip 编译资源.

2) Since you are using Windows (like I do), I would highly recommend taking advantage of Anaconda distribution of Python. Will save you a lot of time in the long run. Basically, it install the binary packages rather than requiring you to compile resources using pip.

既然你用的是Pycharm,安装Anaconda后,回到Pycharm,用Conda新建一个环境,然后pip install numpy.

Since you are using Pycharm, after you install Anaconda, go back to Pycharm, create a new environment using Conda and then pip install numpy.

3) 尝试编译(祝你好运)

3) Try to Compile (Good Luck)

这篇关于Numpy 不安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆