首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >尝试在vscode上使Numpy for python工作

尝试在vscode上使Numpy for python工作
EN

Stack Overflow用户
提问于 2021-01-07 00:31:37
回答 2查看 189关注 0票数 0

尝试导入numpy get错误时,我pip3安装了numpy

错误:退出状态1错误的命令:命令: /Library/Developer/CommandLineTools/usr/bin/python3 /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /var/folders/68/g_0tcg5j6fq8knsy7wwp4q680000gn/T/tmp113k8s2k cwd: /private/var/folders/68/g_0tcg5j6fq8knsy7wwp4q680000gn/T/pip-install-m3_f3w2v/numpy完全输出(237个行):处理numpy/随机/_界_/numpy.237.在处理numpy/随机/_popox.pyx处理numpy/随机/_界_ sources .237.在处理numpy/随机/_sfc64.pyx处理numpy/随机/_mt19937.pyx处理numpy/随机/bit_generator.pyx处理numpy/随机/mtrand.x处理numpy/随机/随机/_generator.x处理numpy/随机/_237 64.pyx处理numpy/随机/_237源blas_opt_info: blas_mkl_info:自定义-iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers C编译器: xcrun -sdk macosx clang未使用- UnixCCompiler -UnixCCompiler比较-Wno code- -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64

代码语言:javascript
运行
复制
creating /var/folders/68/g_0tcg5j6fq8knsy7wwp4q680000gn/T/tmpd69fpqb4/var
creating /var/folders/68/g_0tcg5j6fq8knsy7wwp4q680000gn/T/tmpd69fpqb4/var/folders
creating /var/folders/68/g_0tcg5j6fq8knsy7wwp4q680000gn/T/tmpd69fpqb4/var/folders/68
creating /var/folders/68/g_0tcg5j6fq8knsy7wwp4q680000gn/T/tmpd69fpqb4/var/folders/68/g_0tcg5j6fq8knsy7wwp4q680000gn
creating /var/folders/68/g_0tcg5j6fq8knsy7wwp4q680000gn/T/tmpd69fpqb4/var/folders/68/g_0tcg5j6fq8knsy7wwp4q680000gn/T
creating /var/folders/68/g_0tcg5j6fq8knsy7wwp4q680000gn/T/tmpd69fpqb4/var/folders/68/g_0tcg5j6fq8knsy7wwp4q680000gn/T/tmpd69fpqb4
compile options: '-MMD -MF /var/folders/68/g_0tcg5j6fq8knsy7wwp4q680000gn/T/tmpd69fpqb4/file.c.d -c'
xcrun: /var/folders/68/g_0tcg5j6fq8knsy7wwp4q680000gn/T/tmpd69fpqb4/file.c
  libraries mkl_rt not found in ['/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib', '/usr/local/lib', '/usr/lib']
  NOT AVAILABLE

blis_info:
  libraries blis not found in ['/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib', '/usr/local/lib', '/usr/lib']
  NOT AVAILABLE

openblas_info:
  libraries openblas not found in ['/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib', '/usr/local/lib', '/usr/lib']
  NOT AVAILABLE

atlas_3_10_blas_threads_info:
Setting PTATLAS=ATLAS
  libraries tatlas not found in ['/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib', '/usr/local/lib', '/usr/lib']
  NOT AVAILABLE

atlas_3_10_blas_info:
  libraries satlas not found in ['/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib', '/usr/local/lib', '/usr/lib']
  NOT AVAILABLE

atlas_blas_threads_info:
Setting PTATLAS=ATLAS
  libraries ptf77blas,ptcblas,atlas not found in ['/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib', '/usr/local/lib', '/usr/lib']
  NOT AVAILABLE

atlas_blas_info:
  libraries f77blas,cblas,atlas not found in ['/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib', '/usr/local/lib', '/usr/lib']
  NOT AVAILABLE

accelerate_info:
  libraries accelerate not found in ['/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib', '/usr/local/lib', '/usr/lib']
Library accelerate was not found. Ignoring
  libraries veclib not found in ['/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib', '/usr/local/lib', '/usr/lib']
Library veclib was not found. Ignoring
  FOUND:
    extra_compile_args = ['-msse3', '-I/System/Library/Frameworks/vecLib.framework/Headers']
    extra_link_args = ['-Wl,-framework', '-Wl,Accelerate']
    define_macros = [('NO_ATLAS_INFO', 3), ('HAVE_CBLAS', None)]

  FOUND:
    extra_compile_args = ['-msse3', '-I/System/Library/Frameworks/vecLib.framework/Headers']
    extra_link_args = ['-Wl,-framework', '-Wl,Accelerate']
    define_macros = [('NO_ATLAS_INFO', 3), ('HAVE_CBLAS', None)]

non-existing path in 'numpy/distutils': 'site.cfg'
lapack_opt_info:
lapack_mkl_info:
  libraries mkl_rt not found in ['/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib', '/usr/local/lib', '/usr/lib']
  NOT AVAILABLE

openblas_lapack_info:
  libraries openblas not found in ['/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib', '/usr/local/lib', '/usr/lib']
  NOT AVAILABLE

openblas_clapack_info:
  libraries openblas,lapack not found in ['/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib', '/usr/local/lib', '/usr/lib']
  NOT AVAILABLE

flame_info:
  libraries flame not found in ['/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib', '/usr/local/lib', '/usr/lib']
  NOT AVAILABLE

atlas_3_10_threads_info:
Setting PTATLAS=ATLAS
  libraries lapack_atlas not found in /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib
  libraries tatlas,tatlas not found in /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib
  libraries lapack_atlas not found in /usr/local/lib
  libraries tatlas,tatlas not found in /usr/local/lib
  libraries lapack_atlas not found in /usr/lib
  libraries tatlas,tatlas not found in /usr/lib
<class 'numpy.distutils.system_info.atlas_3_10_threads_info'>
  NOT AVAILABLE

atlas_3_10_info:
  libraries lapack_atlas not found in /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib
  libraries satlas,satlas not found in /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib
  libraries lapack_atlas not found in /usr/local/lib
  libraries satlas,satlas not found in /usr/local/lib
  libraries lapack_atlas not found in /usr/lib
  libraries satlas,satlas not found in /usr/lib
<class 'numpy.distutils.system_info.atlas_3_10_info'>
  NOT AVAILABLE

atlas_threads_info:
Setting PTATLAS=ATLAS
  libraries lapack_atlas not found in /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib
  libraries ptf77blas,ptcblas,atlas not found in /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib
  libraries lapack_atlas not found in /usr/local/lib
  libraries ptf77blas,ptcblas,atlas not found in /usr/local/lib
  libraries lapack_atlas not found in /usr/lib
  libraries ptf77blas,ptcblas,atlas not found in /usr/lib
<class 'numpy.distutils.system_info.atlas_threads_info'>
  NOT AVAILABLE

atlas_info:
  libraries lapack_atlas not found in /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib
  libraries f77blas,cblas,atlas not found in /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib
  libraries lapack_atlas not found in /usr/local/lib
  libraries f77blas,cblas,atlas not found in /usr/local/lib
  libraries lapack_atlas not found in /usr/lib
  libraries f77blas,cblas,atlas not found in /usr/lib
<class 'numpy.distutils.system_info.atlas_info'>
  NOT AVAILABLE

  FOUND:
    extra_compile_args = ['-msse3', '-I/System/Library/Frameworks/vecLib.framework/Headers']
    extra_link_args = ['-Wl,-framework', '-Wl,Accelerate']
    define_macros = [('NO_ATLAS_INFO', 3), ('HAVE_CBLAS', None)]

running dist_info
running build_src
build_src
building py_modules sources
creating build
creating build/src.macosx-10.14.6-x86_64-3.8
creating build/src.macosx-10.14.6-x86_64-3.8/numpy
creating build/src.macosx-10.14.6-x86_64-3.8/numpy/distutils
building library "npymath" sources
Could not locate executable gfortran
Could not locate executable f95
Could not locate executable f90
Could not locate executable f77
Could not locate executable xlf90
Could not locate executable xlf
Could not locate executable ifort
Could not locate executable ifc
Could not locate executable g77
Could not locate executable g95
Could not locate executable pgfortran
don't know how to compile Fortran code on platform 'posix'
creating build/src.macosx-10.14.6-x86_64-3.8/numpy/core
creating build/src.macosx-10.14.6-x86_64-3.8/numpy/core/src
creating build/src.macosx-10.14.6-x86_64-3.8/numpy/core/src/npymath
conv_template:> build/src.macosx-10.14.6-x86_64-3.8/numpy/core/src/npymath/npy_math_internal.h
  adding 'build/src.macosx-10.14.6-x86_64-3.8/numpy/core/src/npymath' to include_dirs.
conv_template:> build/src.macosx-10.14.6-x86_64-3.8/numpy/core/src/npymath/ieee754.c
conv_template:> build/src.macosx-10.14.6-x86_64-3.8/numpy/core/src/npymath/npy_math_complex.c
None - nothing done with h_files = ['build/src.macosx-10.14.6-x86_64-3.8/numpy/core/src/npymath/npy_math_internal.h']
building library "npysort" sources
creating build/src.macosx-10.14.6-x86_64-3.8/numpy/core/src/common
conv_template:> build/src.macosx-10.14.6-x86_64-3.8/numpy/core/src/common/npy_sort.h
  adding 'build/src.macosx-10.14.6-x86_64-3.8/numpy/core/src/common' to include_dirs.
creating build/src.macosx-10.14.6-x86_64-3.8/numpy/core/src/npysort
conv_template:> build/src.macosx-10.14.6-x86_64-3.8/numpy/core/src/npysort/quicksort.c
conv_template:> build/src.macosx-10.14.6-x86_64-3.8/numpy/core/src/npysort/mergesort.c
conv_template:> build/src.macosx-10.14.6-x86_64-3.8/numpy/core/src/npysort/timsort.c
conv_template:> build/src.macosx-10.14.6-x86_64-3.8/numpy/core/src/npysort/heapsort.c
conv_template:> build/src.macosx-10.14.6-x86_64-3.8/numpy/core/src/npysort/radixsort.c
conv_template:> build/src.macosx-10.14.6-x86_64-3.8/numpy/core/src/common/npy_partition.h
conv_template:> build/src.macosx-10.14.6-x86_64-3.8/numpy/core/src/npysort/selection.c
conv_template:> build/src.macosx-10.14.6-x86_64-3.8/numpy/core/src/common/npy_binsearch.h
conv_template:> build/src.macosx-10.14.6-x86_64-3.8/numpy/core/src/npysort/binsearch.c
None - nothing done with h_files = ['build/src.macosx-10.14.6-x86_64-3.8/numpy/core/src/common/npy_sort.h', 'build/src.macosx-10.14.6-x86_64-3.8/numpy/core/src/common/npy_partition.h', 'build/src.macosx-10.14.6-x86_64-3.8/numpy/core/src/common/npy_binsearch.h']
building library "npyrandom" sources
building extension "numpy.core._multiarray_tests" sources
creating build/src.macosx-10.14.6-x86_64-3.8/numpy/core/src/multiarray
conv_template:> build/src.macosx-10.14.6-x86_64-3.8/numpy/core/src/multiarray/_multiarray_tests.c
building extension "numpy.core._multiarray_umath" sources
Running from numpy source directory.
setup.py:480: UserWarning: Unrecognized setuptools command, proceeding with generating Cython sources and expanding templates
  run_build = parse_setuppy_commands()
/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/distutils/dist.py:274: UserWarning: Unknown distribution option: 'define_macros'
  warnings.warn(msg)
Traceback (most recent call last):
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 207, in <module>
    main()
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 197, in main
    json_out['return_val'] = hook(**hook_input['kwargs'])
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 69, in prepare_metadata_for_build_wheel
    return hook(metadata_directory, config_settings)
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages/setuptools/build_meta.py", line 156, in prepare_metadata_for_build_wheel
    self.run_setup()
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages/setuptools/build_meta.py", line 236, in run_setup
    super(_BuildMetaLegacyBackend,
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages/setuptools/build_meta.py", line 142, in run_setup
    exec(compile(code, __file__, 'exec'), locals())
  File "setup.py", line 508, in <module>
    setup_package()
  File "setup.py", line 500, in setup_package
    setup(**metadata)
  File "/private/var/folders/68/g_0tcg5j6fq8knsy7wwp4q680000gn/T/pip-install-m3_f3w2v/numpy/numpy/distutils/core.py", line 169, in setup
    return old_setup(**new_attr)
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages/setuptools/__init__.py", line 145, in setup
    return distutils.core.setup(**attrs)
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/distutils/dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages/setuptools/command/dist_info.py", line 31, in run
    egg_info.run()
  File "/private/var/folders/68/g_0tcg5j6fq8knsy7wwp4q680000gn/T/pip-install-m3_f3w2v/numpy/numpy/distutils/command/egg_info.py", line 24, in run
    self.run_command("build_src")
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/private/var/folders/68/g_0tcg5j6fq8knsy7wwp4q680000gn/T/pip-install-m3_f3w2v/numpy/numpy/distutils/command/build_src.py", line 144, in run
    self.build_sources()
  File "/private/var/folders/68/g_0tcg5j6fq8knsy7wwp4q680000gn/T/pip-install-m3_f3w2v/numpy/numpy/distutils/command/build_src.py", line 161, in build_sources
    self.build_extension_sources(ext)
  File "/private/var/folders/68/g_0tcg5j6fq8knsy7wwp4q680000gn/T/pip-install-m3_f3w2v/numpy/numpy/distutils/command/build_src.py", line 318, in build_extension_sources
    sources = self.generate_sources(sources, ext)
  File "/private/var/folders/68/g_0tcg5j6fq8knsy7wwp4q680000gn/T/pip-install-m3_f3w2v/numpy/numpy/distutils/command/build_src.py", line 378, in generate_sources
    source = func(extension, build_dir)
  File "numpy/core/setup.py", line 436, in generate_config_h
    moredefs, ignored = cocache.check_types(config_cmd, ext, build_dir)
  File "numpy/core/setup.py", line 47, in check_types
    out = check_types(*a, **kw)
  File "numpy/core/setup.py", line 292, in check_types
    raise SystemError(
SystemError: Cannot compile 'Python.h'. Perhaps you need to install python-dev|python-devel.
----------------------------------------

/Library/Developer/CommandLineTools/usr/bin/python3 /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /var/folders/68/g_0tcg5j6fq8knsy7wwp4q680000gn/T/tmp113k8s2k :检查日志以获得完整的命令输出.

EN

回答 2

Stack Overflow用户

发布于 2021-01-07 00:59:36

您可以尝试使用anaconda,它附带了numpy预安装,您所要做的就是

代码语言:javascript
运行
复制
    import numpy as np
票数 0
EN

Stack Overflow用户

发布于 2021-01-07 01:22:35

根据this answer,您只需运行

代码语言:javascript
运行
复制
apt-get install pythonx.x-dev

x.x替换为您安装的Python版本。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65605127

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档