库安装 Python + Spyder
Posted
技术标签:
【中文标题】库安装 Python + Spyder【英文标题】:Library Installation Python + Spyder 【发布时间】:2020-12-21 09:39:44 【问题描述】:我在安装 Numpy、Sklearn 等 Python 库时遇到问题。我想将这些库与 Spyder 一起使用。我确实重置了我的 Windows,这是我重新安装以前拥有的库的尝试。但我收到这样的错误,我不知道这个错误的正确关键字。在这里。
C:\Users\User>pip install sklearn
Collecting sklearn
Using cached sklearn-0.0.tar.gz (1.1 kB)
Collecting scikit-learn
Using cached scikit-learn-0.23.2.tar.gz (7.2 MB)
Installing build dependencies ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\user\appdata\local\programs\python\python39\python.exe' 'c:\users\user\appdata\local\programs\python\python39\lib\site-packages\pip' install --ignore-installed --no-user --prefix 'C:\Users\User\AppData\Local\Temp\pip-build-env-unikug53\overlay' --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel 'Cython>=0.28.5' 'numpy==1.13.3; python_version=='"'"'3.6'"'"' and platform_system!='"'"'AIX'"'"' and platform_python_implementation == '"'"'CPython'"'"'' 'numpy==1.14.0; python_version=='"'"'3.6'"'"' and platform_system!='"'"'AIX'"'"' and platform_python_implementation != '"'"'CPython'"'"'' 'numpy==1.14.5; python_version=='"'"'3.7'"'"' and platform_system!='"'"'AIX'"'"'' 'numpy==1.17.3; python_version>='"'"'3.8'"'"' and platform_system!='"'"'AIX'"'"'' 'numpy==1.16.0; python_version=='"'"'3.6'"'"' and platform_system=='"'"'AIX'"'"'' 'numpy==1.16.0; python_version=='"'"'3.7'"'"' and platform_system=='"'"'AIX'"'"'' 'numpy==1.17.3; python_version>='"'"'3.8'"'"' and platform_system=='"'"'AIX'"'"'' 'scipy>=0.19.1'
cwd: None
Complete output (303 lines):
Ignoring numpy: markers 'python_version == "3.6" and platform_system != "AIX" and platform_python_implementation == "CPython"' don't match your environment
Ignoring numpy: markers 'python_version == "3.6" and platform_system != "AIX" and platform_python_implementation != "CPython"' don't match your environment
Ignoring numpy: markers 'python_version == "3.7" and platform_system != "AIX"' don't match your environment
Ignoring numpy: markers 'python_version == "3.6" and platform_system == "AIX"' don't match your environment
Ignoring numpy: markers 'python_version == "3.7" and platform_system == "AIX"' don't match your environment
Ignoring numpy: markers 'python_version >= "3.8" and platform_system == "AIX"' don't match your environment
Collecting numpy==1.17.3
Using cached numpy-1.17.3.zip (6.4 MB)
Collecting Cython>=0.28.5
Using cached Cython-0.29.21-py2.py3-none-any.whl (974 kB)
Collecting scipy>=0.19.1
Using cached scipy-1.5.4-cp39-cp39-win_amd64.whl (31.4 MB)
Collecting wheel
Using cached wheel-0.36.2-py2.py3-none-any.whl (35 kB)
Collecting setuptools
Using cached setuptools-51.1.0.post20201221-py3-none-any.whl (2.0 MB)
Using legacy 'setup.py install' for numpy, since package 'wheel' is not installed.
Installing collected packages: numpy, wheel, setuptools, scipy, Cython
Running setup.py install for numpy: started
Running setup.py install for numpy: finished with status 'error'
ERROR: Command errored out with exit status 1:
command: 'c:\users\user\appdata\local\programs\python\python39\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\User\\AppData\\Local\\Temp\\pip-install-or8kng1a\\numpy_78f1af95d1d34e88a1f680833069efb4\\setup.py'"'"'; __file__='"'"'C:\\Users\\User\\AppData\\Local\\Temp\\pip-install-or8kng1a\\numpy_78f1af95d1d34e88a1f680833069efb4\\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\User\AppData\Local\Temp\pip-record-_yokuvzg\install-record.txt' --single-version-externally-managed --prefix 'C:\Users\User\AppData\Local\Temp\pip-build-env-unikug53\overlay' --compile --install-headers 'C:\Users\User\AppData\Local\Temp\pip-build-env-unikug53\overlay\Include\numpy'
cwd: C:\Users\User\AppData\Local\Temp\pip-install-or8kng1a\numpy_78f1af95d1d34e88a1f680833069efb4\
Complete output (277 lines):
Running from numpy source directory.
Note: if you need reliable uninstall behavior, then install
with pip instead of using `setup.py install`:
- `pip install .` (from a git repo or downloaded source
release)
- `pip install numpy` (last NumPy release on PyPi)
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\\user\\appdata\\local\\programs\\python\\python39\\lib', 'C:\\', 'c:\\users\\user\\appdata\\local\\programs\\python\\python39\\libs']
NOT AVAILABLE
blis_info:
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries blis not found in ['c:\\users\\user\\appdata\\local\\programs\\python\\python39\\lib', 'C:\\', 'c:\\users\\user\\appdata\\local\\programs\\python\\python39\\libs']
NOT AVAILABLE
openblas_info:
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries openblas not found in ['c:\\users\\user\\appdata\\local\\programs\\python\\python39\\lib', 'C:\\', 'c:\\users\\user\\appdata\\local\\programs\\python\\python39\\libs']
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
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries tatlas not found in ['c:\\users\\user\\appdata\\local\\programs\\python\\python39\\lib', 'C:\\', 'c:\\users\\user\\appdata\\local\\programs\\python\\python39\\libs']
NOT AVAILABLE
atlas_3_10_blas_info:
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries satlas not found in ['c:\\users\\user\\appdata\\local\\programs\\python\\python39\\lib', 'C:\\', 'c:\\users\\user\\appdata\\local\\programs\\python\\python39\\libs']
NOT AVAILABLE
atlas_blas_threads_info:
Setting PTATLAS=ATLAS
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries ptf77blas,ptcblas,atlas not found in ['c:\\users\\user\\appdata\\local\\programs\\python\\python39\\lib', 'C:\\', 'c:\\users\\user\\appdata\\local\\programs\\python\\python39\\libs']
NOT AVAILABLE
atlas_blas_info:
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries f77blas,cblas,atlas not found in ['c:\\users\\user\\appdata\\local\\programs\\python\\python39\\lib', 'C:\\', 'c:\\users\\user\\appdata\\local\\programs\\python\\python39\\libs']
NOT AVAILABLE
accelerate_info:
NOT AVAILABLE
C:\Users\User\AppData\Local\Temp\pip-install-or8kng1a\numpy_78f1af95d1d34e88a1f680833069efb4\numpy\distutils\system_info.py:690: 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.
self.calc_info()
blas_info:
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries blas not found in ['c:\\users\\user\\appdata\\local\\programs\\python\\python39\\lib', 'C:\\', 'c:\\users\\user\\appdata\\local\\programs\\python\\python39\\libs']
NOT AVAILABLE
C:\Users\User\AppData\Local\Temp\pip-install-or8kng1a\numpy_78f1af95d1d34e88a1f680833069efb4\numpy\distutils\system_info.py:690: 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()
blas_src_info:
NOT AVAILABLE
C:\Users\User\AppData\Local\Temp\pip-install-or8kng1a\numpy_78f1af95d1d34e88a1f680833069efb4\numpy\distutils\system_info.py:690: 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()
NOT AVAILABLE
'svnversion' is not recognized as an internal or external command,
operable program or batch file.
non-existing path in 'numpy\\distutils': 'site.cfg'
lapack_opt_info:
lapack_mkl_info:
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries mkl_rt not found in ['c:\\users\\user\\appdata\\local\\programs\\python\\python39\\lib', 'C:\\', 'c:\\users\\user\\appdata\\local\\programs\\python\\python39\\libs']
NOT AVAILABLE
openblas_lapack_info:
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries openblas not found in ['c:\\users\\user\\appdata\\local\\programs\\python\\python39\\lib', 'C:\\', 'c:\\users\\user\\appdata\\local\\programs\\python\\python39\\libs']
NOT AVAILABLE
openblas_clapack_info:
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries openblas,lapack not found in ['c:\\users\\user\\appdata\\local\\programs\\python\\python39\\lib', 'C:\\', 'c:\\users\\user\\appdata\\local\\programs\\python\\python39\\libs']
NOT AVAILABLE
flame_info:
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries flame not found in ['c:\\users\\user\\appdata\\local\\programs\\python\\python39\\lib', 'C:\\', 'c:\\users\\user\\appdata\\local\\programs\\python\\python39\\libs']
NOT AVAILABLE
atlas_3_10_threads_info:
Setting PTATLAS=ATLAS
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries lapack_atlas not found in c:\users\user\appdata\local\programs\python\python39\lib
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries tatlas,tatlas not found in c:\users\user\appdata\local\programs\python\python39\lib
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries lapack_atlas not found in C:\
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries tatlas,tatlas not found in C:\
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries lapack_atlas not found in c:\users\user\appdata\local\programs\python\python39\libs
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries tatlas,tatlas not found in c:\users\user\appdata\local\programs\python\python39\libs
<class 'numpy.distutils.system_info.atlas_3_10_threads_info'>
NOT AVAILABLE
atlas_3_10_info:
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries lapack_atlas not found in c:\users\user\appdata\local\programs\python\python39\lib
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries satlas,satlas not found in c:\users\user\appdata\local\programs\python\python39\lib
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries lapack_atlas not found in C:\
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries satlas,satlas not found in C:\
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries lapack_atlas not found in c:\users\user\appdata\local\programs\python\python39\libs
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries satlas,satlas not found in c:\users\user\appdata\local\programs\python\python39\libs
<class 'numpy.distutils.system_info.atlas_3_10_info'>
NOT AVAILABLE
atlas_threads_info:
Setting PTATLAS=ATLAS
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries lapack_atlas not found in c:\users\user\appdata\local\programs\python\python39\lib
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries ptf77blas,ptcblas,atlas not found in c:\users\user\appdata\local\programs\python\python39\lib
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries lapack_atlas not found in C:\
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries ptf77blas,ptcblas,atlas not found in C:\
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries lapack_atlas not found in c:\users\user\appdata\local\programs\python\python39\libs
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries ptf77blas,ptcblas,atlas not found in c:\users\user\appdata\local\programs\python\python39\libs
<class 'numpy.distutils.system_info.atlas_threads_info'>
NOT AVAILABLE
atlas_info:
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries lapack_atlas not found in c:\users\user\appdata\local\programs\python\python39\lib
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries f77blas,cblas,atlas not found in c:\users\user\appdata\local\programs\python\python39\lib
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries lapack_atlas not found in C:\
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries f77blas,cblas,atlas not found in C:\
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries lapack_atlas not found in c:\users\user\appdata\local\programs\python\python39\libs
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries f77blas,cblas,atlas not found in c:\users\user\appdata\local\programs\python\python39\libs
<class 'numpy.distutils.system_info.atlas_info'>
NOT AVAILABLE
lapack_info:
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries lapack not found in ['c:\\users\\user\\appdata\\local\\programs\\python\\python39\\lib', 'C:\\', 'c:\\users\\user\\appdata\\local\\programs\\python\\python39\\libs']
NOT AVAILABLE
C:\Users\User\AppData\Local\Temp\pip-install-or8kng1a\numpy_78f1af95d1d34e88a1f680833069efb4\numpy\distutils\system_info.py:1712: 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.
if getattr(self, '_calc_info_'.format(lapack))():
lapack_src_info:
NOT AVAILABLE
C:\Users\User\AppData\Local\Temp\pip-install-or8kng1a\numpy_78f1af95d1d34e88a1f680833069efb4\numpy\distutils\system_info.py:1712: 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.
if getattr(self, '_calc_info_'.format(lapack))():
NOT AVAILABLE
c:\users\user\appdata\local\programs\python\python39\lib\distutils\dist.py:274: UserWarning: Unknown distribution option: 'define_macros'
warnings.warn(msg)
running install
running build
running config_cc
unifing config_cc, config, build_clib, build_ext, build commands --compiler options
running config_fc
unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options
running build_src
build_src
building py_modules sources
creating build
creating build\src.win-amd64-3.9
creating build\src.win-amd64-3.9\numpy
creating build\src.win-amd64-3.9\numpy\distutils
building library "npymath" sources
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\user\appdata\local\programs\python\python39\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\User\\AppData\\Local\\Temp\\pip-install-or8kng1a\\numpy_78f1af95d1d34e88a1f680833069efb4\\setup.py'"'"'; __file__='"'"'C:\\Users\\User\\AppData\\Local\\Temp\\pip-install-or8kng1a\\numpy_78f1af95d1d34e88a1f680833069efb4\\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\User\AppData\Local\Temp\pip-record-_yokuvzg\install-record.txt' --single-version-externally-managed --prefix 'C:\Users\User\AppData\Local\Temp\pip-build-env-unikug53\overlay' --compile --install-headers 'C:\Users\User\AppData\Local\Temp\pip-build-env-unikug53\overlay\Include\numpy' Check the logs for full command output.
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\user\appdata\local\programs\python\python39\python.exe' 'c:\users\user\appdata\local\programs\python\python39\lib\site-packages\pip' install --ignore-installed --no-user --prefix 'C:\Users\User\AppData\Local\Temp\pip-build-env-unikug53\overlay' --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel 'Cython>=0.28.5' 'numpy==1.13.3; python_version=='"'"'3.6'"'"' and platform_system!='"'"'AIX'"'"' and platform_python_implementation == '"'"'CPython'"'"'' 'numpy==1.14.0; python_version=='"'"'3.6'"'"' and platform_system!='"'"'AIX'"'"' and platform_python_implementation != '"'"'CPython'"'"'' 'numpy==1.14.5; python_version=='"'"'3.7'"'"' and platform_system!='"'"'AIX'"'"'' 'numpy==1.17.3; python_version>='"'"'3.8'"'"' and platform_system!='"'"'AIX'"'"'' 'numpy==1.16.0; python_version=='"'"'3.6'"'"' and platform_system=='"'"'AIX'"'"'' 'numpy==1.16.0; python_version=='"'"'3.7'"'"' and platform_system=='"'"'AIX'"'"'' 'numpy==1.17.3; python_version>='"'"'3.8'"'"' and platform_system=='"'"'AIX'"'"'' 'scipy>=0.19.1' Check the logs for full command output.
重置后我确实在没有 Anaconda 的情况下单独安装了 Spyder。在我尝试运行包含 sklearn 的代码后,我收到了 Module Not Found 错误。 我应该尝试从头开始安装 Anaconda 还是有解决方案?
提前谢谢你
【问题讨论】:
此消息可能意味着:“错误:需要 Microsoft Visual C++ 14.0 或更高版本。使用“Microsoft C++ Build Tools”获取它:visualstudio.microsoft.com/visual-cpp-build-tools" @IainShelvington 当我检查我的应用程序时,我安装了它。以防万一我尝试重新安装它但仍然无法正常工作,很遗憾。 【参考方案1】:这似乎是一个常见问题。 Sklearn
需要NumPy
,据我所知,您的问题出在哪里。尝试降级到python 3.8
。
【讨论】:
我尝试降级并且它有效。现在我需要尝试将 spyder 与它集成。【参考方案2】:请尝试:
pip install -U scikit-learn
如果这不起作用,请清理计算机上的 python 环境,然后安装 anaconda。 Anaconda真的不重,内置spyder 4。
如果你没用过anaconda,清理一下你当前的python环境,重新安装低版本的python。在我看来,3.6版本使用的是最稳定的。
【讨论】:
【参考方案3】:总的来说,我尝试降级它并且它有效。该库的安装工作正常,但它的主要问题尚未解决。虽然之后 Spyder 给出了不同的错误信息,但我仍然无法使用该库。
最后,我尝试从头开始安装所有 Anaconda,它可以正常工作。 感谢您的回答,非常感谢。 :)
【讨论】:
以上是关于库安装 Python + Spyder的主要内容,如果未能解决你的问题,请参考以下文章