Numpy Does Not Install



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

我在终端中输入以下内容:

点子安装数字

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

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

错误信息:

(venv) C:UserspcPycharmProjectsTutorials>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:UserspcPycharmProjectsTutorialsvenvScriptspython.exe C:UserspcPycharmProjectsTutorialsvenvlibsite-packagespip-19.0.3-py3.8.eggpip_vendorpep517_in_process.py prepare_meta
data_for_build_wheel C:UserspcAppDataLocalTemptmp7lo0j8qw:
Processing numpy/random_bounded_integers.pxd.in
Processing numpy/randommtrand.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:UserspcPycharmProjectsTutorialsvenvlib
libraries tatlas,tatlas not found in C:UserspcPycharmProjectsTutorialsvenvlib
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:UserspcPycharmProjectsTutorialsvenvlib
libraries satlas,satlas not found in C:UserspcPycharmProjectsTutorialsvenvlib
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:UserspcPycharmProjectsTutorialsvenvlib
libraries ptf77blas,ptcblas,atlas not found in C:UserspcPycharmProjectsTutorialsvenvlib
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:UserspcPycharmProjectsTutorialsvenvlib
libraries f77blas,cblas,atlas not found in C:UserspcPycharmProjectsTutorialsvenvlib
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 buildsrc.win-amd64-3.8
creating buildsrc.win-amd64-3.8numpy
creating buildsrc.win-amd64-3.8numpydistutils
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:UserspcAppDataLocalTemppip-install-az7mvo02numpynumpydistutilssystem_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:UserspcAppDataLocalTemppip-install-az7mvo02numpynumpydistutilssystem_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:UserspcAppDataLocalTemppip-install-az7mvo02numpynumpydistutilssystem_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:UserspcAppDataLocalTemppip-install-az7mvo02numpynumpydistutilssystem_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:UserspcAppDataLocalTemppip-install-az7mvo02numpynumpydistutilssystem_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:UserspcAppDataLocalProgramsPythonPython38libdistutilsdist.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:UserspcPycharmProjectsTutorialsvenvScriptspython.exe C:UserspcPycharmProjectsTutorialsvenvlibsite-packagespip-19.0.3-py3.8.eggpip_vendorpep517_in_process.py prepare_metadata_for_build_wheel C:
UserspcAppDataLocalTemptmp7lo0j8qw" failed with error code 1 in C:UserspcAppDataLocalTemppip-install-az7mvo02numpy

升级点时出错:

(venv) C:UserspcPycharmProjectsTutorials>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:userspcpycharmprojectstutorialsvenvlibsite-packagespip-19.0.3-py3.8.egg
from C:UserspcPycharmProjectsTutorialsvenvLibsite-packages~ip-19.0.3-py3.8.egg
Moving to c:userspcpycharmprojectstutorialsvenvscriptspip-script.py
from C:UserspcAppDataLocalTemppip-uninstall-hqx4h1fbpip-script.py
Moving to c:userspcpycharmprojectstutorialsvenvscriptspip.exe
from C:UserspcAppDataLocalTemppip-uninstall-hqx4h1fbpip.exe
Moving to c:userspcpycharmprojectstutorialsvenvscriptspip3-script.py
from C:UserspcAppDataLocalTemppip-uninstall-hqx4h1fbpip3-script.py
Moving to c:userspcpycharmprojectstutorialsvenvscriptspip3.8-script.py
from C:UserspcAppDataLocalTemppip-uninstall-hqx4h1fbpip3.8-script.py
Moving to c:userspcpycharmprojectstutorialsvenvscriptspip3.8.exe
from C:UserspcAppDataLocalTemppip-uninstall-hqx4h1fbpip3.8.exe
Moving to c:userspcpycharmprojectstutorialsvenvscriptspip3.exe
from C:UserspcAppDataLocalTemppip-uninstall-hqx4h1fbpip3.exe
Exception:
Traceback (most recent call last):
File "C:UserspcPycharmProjectsTutorialsvenvlibsite-packagespip-19.0.3-py3.8.eggpip_internalclibase_command.py", line 179, in main
status = self.run(options, args)
File "C:UserspcPycharmProjectsTutorialsvenvlibsite-packagespip-19.0.3-py3.8.eggpip_internalcommandsinstall.py", line 384, in run
installed = install_given_reqs(
File "C:UserspcPycharmProjectsTutorialsvenvlibsite-packagespip-19.0.3-py3.8.eggpip_internalreq__init__.py", line 53, in install_given_reqs
requirement.install(
File "C:UserspcPycharmProjectsTutorialsvenvlibsite-packagespip-19.0.3-py3.8.eggpip_internalreqreq_install.py", line 910, in install
self.move_wheel_files(
File "C:UserspcPycharmProjectsTutorialsvenvlibsite-packagespip-19.0.3-py3.8.eggpip_internalreqreq_install.py", line 437, in move_wheel_files
move_wheel_files(
File "C:UserspcPycharmProjectsTutorialsvenvlibsite-packagespip-19.0.3-py3.8.eggpip_internalwheel.py", line 544, in move_wheel_files
generated.extend(maker.make(spec))
File "C:UserspcPycharmProjectsTutorialsvenvlibsite-packagespip-19.0.3-py3.8.eggpip_vendordistlibscripts.py", line 405, in make
self._make_script(entry, filenames, options=options)
File "C:UserspcPycharmProjectsTutorialsvenvlibsite-packagespip-19.0.3-py3.8.eggpip_vendordistlibscripts.py", line 309, in _make_script
self._write_script(scriptnames, shebang, script, filenames, ext)
File "C:UserspcPycharmProjectsTutorialsvenvlibsite-packagespip-19.0.3-py3.8.eggpip_vendordistlibscripts.py", line 245, in _write_script
launcher = self._get_launcher('t')
File "C:UserspcPycharmProjectsTutorialsvenvlibsite-packagespip-19.0.3-py3.8.eggpip_vendordistlibscripts.py", line 384, in _get_launcher
result = finder(distlib_package).find(name).bytes
AttributeError: 'NoneType' object has no attribute 'bytes'

有几个选项:

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

对于不提供自己的 Windows 安装程序的项目(和 甚至有些人这样做),加州大学的克里斯托夫·戈尔克(Christoph Gohlke) 提供了 Windows 安装程序的集合。许多 Python 用户在 Windows报告了这些预构建的积极体验 版本。源

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

搜索并下载:

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

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

pip install C:Userspcdownloadsnumpy‑1.18.2+mkl‑cp38‑cp38‑win_amd64.whl

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

由于您使用的是 Pycharm,因此在安装 Anaconda 之后,请返回 Pycharm,使用 Conda 创建一个新环境,然后 pip 安装 numpy。

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