Numpy не устанавливается - PullRequest
0 голосов
/ 28 марта 2020

Я в основном пытаюсь установить Pandas, но для этого якобы предполагается установить Numpy.

Я набираю это в терминале:

pip install numpy

И я получаю ошибку, которая в основном говорит, что мне нужна Microsoft Visual Studio C ++ 14.0. После того, как я скачал его по предоставленной ссылке, я совершенно не представляю, как с ним работать. Я пытался использовать учебник YouTube о том, как использовать Visual Studio, но когда они создают проект, у меня нет ни одного из их вариантов. Единственный вариант, который у меня есть, - создать пустое решение.

Если остальная часть сообщения об ошибке необходима, пожалуйста, предупредите меня об этом, я только начал работать с Python в течение пары месяцев, поэтому Я не очень опытный.

Сообщение об ошибке:

(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

Ошибка при обновлении пипа:

(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 Ответ

1 голос
/ 28 марта 2020

Есть несколько вариантов:

1) Загрузите двоичный файл с Неофициальный Windows Двоичный файл для Python Пакеты расширений

Для проектов, которые не Кристоф Гольке (Christoph Gohlke) из Калифорнийского университета не предоставляет своих собственных установщиков Windows (и даже некоторых из них). Многие пользователи Python на Windows сообщили о положительном опыте использования этих предварительно собранных версий. Источник

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

Поиск и загрузка:

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

Откройте терминал, активируйте env и установите (измените путь к месту загрузки файла):

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

2) Поскольку вы используете Windows (как я), я настоятельно рекомендую воспользоваться Anaconda дистрибутивом Python. Сэкономит вам много времени в долгосрочной перспективе. По сути, он устанавливает бинарные пакеты, а не требует компиляции ресурсов с помощью pip.

Поскольку вы используете Pycharm, после установки Anaconda, go вернитесь в Pycharm, создайте новую среду с помощью Conda и затем pip установить numpy.

3) Попробуйте скомпилировать (удачи)

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...