无法在虚拟环境中安装熊猫(和numpy)



所以,最近我决定尝试在我的新django项目中使用venv。我正在学习一些教程,但是现在我遇到了一个问题——我无法安装Pandas包。我通过Windows PowerShall安装django没有问题,但是在我试图用这个命令安装pandas之后(.vkr) PS C:django>Python -m PIP install pandas我得到这个:

Collecting pandas
Using cached pandas-1.5.2.tar.gz (5.2 MB)
Installing build dependencies ... error
error: subprocess-exited-with-error
× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> [269 lines of output]
Collecting setuptools>=51.0.0
Using cached setuptools-65.6.3-py3-none-any.whl (1.2 MB)
Collecting wheel
Using cached wheel-0.38.4-py3-none-any.whl (36 kB)
Collecting Cython<3,>=0.29.32
Using cached Cython-0.29.32-py2.py3-none-any.whl (986 kB)
Collecting oldest-supported-numpy>=2022.8.16
Using cached oldest_supported_numpy-2022.11.19-py3-none-any.whl (4.9 kB)
Collecting numpy==1.19.3
Using cached numpy-1.19.3.zip (7.3 MB)
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'done'
Preparing metadata (pyproject.toml): started
Preparing metadata (pyproject.toml): finished with status 'error'
error: subprocess-exited-with-error
Preparing metadata (pyproject.toml) did not run successfully.
exit code: 1
[236 lines of output]
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()
Processing numpy/random_bounded_integers.pxd.in
Processing numpy/randombit_generator.pyx
Processing numpy/randommtrand.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:
customize Mingw32CCompiler
libraries mkl_rt not found in ['C:\django\.vkr\lib', 'C:\']
NOT AVAILABLE
blis_info:
libraries blis not found in ['C:\django\.vkr\lib', 'C:\']
NOT AVAILABLE
openblas_info:
libraries openblas not found in ['C:\django\.vkr\lib', 'C:\']
NOT AVAILABLE
atlas_3_10_blas_threads_info:
Setting PTATLAS=ATLAS
libraries tatlas not found in ['C:\django\.vkr\lib', 'C:\']
NOT AVAILABLE
atlas_3_10_blas_info:
libraries satlas not found in ['C:\django\.vkr\lib', 'C:\']
NOT AVAILABLE
atlas_blas_threads_info:
Setting PTATLAS=ATLAS
libraries ptf77blas,ptcblas,atlas not found in ['C:\django\.vkr\lib', 'C:\']
NOT AVAILABLE
atlas_blas_info:
libraries f77blas,cblas,atlas not found in ['C:\django\.vkr\lib', 'C:\']
NOT AVAILABLE
accelerate_info:
NOT AVAILABLE
C:UsersZenBookAppDataLocalTemppip-install-umn76yiznumpy_f76fed0aa6fd429dbfd840b2dced598cnumpydistutilssystem_info.py:1914: 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):
blas_info:
libraries blas not found in ['C:\django\.vkr\lib', 'C:\']
NOT AVAILABLE
C:UsersZenBookAppDataLocalTemppip-install-umn76yiznumpy_f76fed0aa6fd429dbfd840b2dced598cnumpydistutilssystem_info.py:1914: 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):
blas_src_info:
NOT AVAILABLE
C:UsersZenBookAppDataLocalTemppip-install-umn76yiznumpy_f76fed0aa6fd429dbfd840b2dced598cnumpydistutilssystem_info.py:1914: 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):
NOT AVAILABLE
non-existing path in 'numpy\distutils': 'site.cfg'
lapack_opt_info:
lapack_mkl_info:
libraries mkl_rt not found in ['C:\django\.vkr\lib', 'C:\']
NOT AVAILABLE
openblas_lapack_info:
libraries openblas not found in ['C:\django\.vkr\lib', 'C:\']
NOT AVAILABLE
openblas_clapack_info:
libraries openblas,lapack not found in ['C:\django\.vkr\lib', 'C:\']
NOT AVAILABLE
flame_info:
libraries flame not found in ['C:\django\.vkr\lib', 'C:\']
NOT AVAILABLE
atlas_3_10_threads_info:
Setting PTATLAS=ATLAS
libraries lapack_atlas not found in C:django.vkrlib
libraries tatlas,tatlas not found in C:django.vkrlib
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:django.vkrlib
libraries satlas,satlas not found in C:django.vkrlib
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:django.vkrlib
libraries ptf77blas,ptcblas,atlas not found in C:django.vkrlib
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:django.vkrlib
libraries f77blas,cblas,atlas not found in C:django.vkrlib
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:\django\.vkr\lib', 'C:\']
NOT AVAILABLE
C:UsersZenBookAppDataLocalTemppip-install-umn76yiznumpy_f76fed0aa6fd429dbfd840b2dced598cnumpydistutilssystem_info.py:1748: 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))()
lapack_src_info:
NOT AVAILABLE
C:UsersZenBookAppDataLocalTemppip-install-umn76yiznumpy_f76fed0aa6fd429dbfd840b2dced598cnumpydistutilssystem_info.py:1748: 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))()
NOT AVAILABLE
numpy_linalg_lapack_lite:
FOUND:
language = c
define_macros = [('HAVE_BLAS_ILP64', None), ('BLAS_SYMBOL_SUFFIX', '64_')]
C:msys64mingw64libpython3.9distutilsdist.py:274: UserWarning: Unknown distribution option: 'define_macros'
warnings.warn(msg)
running dist_info
running build_src
build_src
building py_modules sources
creating build
creating buildsrc.mingw_x86_64-3.9
creating buildsrc.mingw_x86_64-3.9numpy
creating buildsrc.mingw_x86_64-3.9numpydistutils
building library "npymath" sources
Traceback (most recent call last):
File "C:UsersZenBookAppDataLocalTemppip-install-umn76yiznumpy_f76fed0aa6fd429dbfd840b2dced598cnumpydistutilsfcompilercompaq.py", line 78, in CompaqVisualFCompiler
m.initialize()
File "C:UsersZenBookAppDataLocalTemppip-install-umn76yiznumpy_f76fed0aa6fd429dbfd840b2dced598cnumpydistutilsmsvccompiler.py", line 48, in initialize
_MSVCCompiler.initialize(self)
File "C:msys64mingw64libpython3.9distutilsmsvccompiler.py", line 259, in initialize
self.__paths = self.get_msvc_paths("path")
File "C:msys64mingw64libpython3.9distutilsmsvccompiler.py", line 602, in get_msvc_paths
r"Win32 (%s)Directories" % (self.__root, platform))
AttributeError: 'MSVCCompiler' object has no attribute '_MSVCCompiler__root'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:django.vkrlibpython3.9site-packagespip_vendorpep517in_process_in_process.py", line 351, in <module>
main()
File "C:django.vkrlibpython3.9site-packagespip_vendorpep517in_process_in_process.py", line 333, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "C:django.vkrlibpython3.9site-packagespip_vendorpep517in_process_in_process.py", line 152, in prepare_metadata_for_build_wheel
return hook(metadata_directory, config_settings)
File "C:UsersZenBookAppDataLocalTemppip-build-env-2iw3wr9ooverlaylibpython3.9site-packagessetuptoolsbuild_meta.py", line 157, in prepare_metadata_for_build_wheel
self.run_setup()
File "C:UsersZenBookAppDataLocalTemppip-build-env-2iw3wr9ooverlaylibpython3.9site-packagessetuptoolsbuild_meta.py", line 248, in run_setup
super(_BuildMetaLegacyBackend,
File "C:UsersZenBookAppDataLocalTemppip-build-env-2iw3wr9ooverlaylibpython3.9site-packagessetuptoolsbuild_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 "C:UsersZenBookAppDataLocalTemppip-install-umn76yiznumpy_f76fed0aa6fd429dbfd840b2dced598cnumpydistutilscore.py", line 169, in setup
return old_setup(**new_attr)
File "C:UsersZenBookAppDataLocalTemppip-build-env-2iw3wr9ooverlaylibpython3.9site-packagessetuptools__init__.py", line 165, in setup
return distutils.core.setup(**attrs)
File "C:msys64mingw64libpython3.9distutilscore.py", line 148, in setup
dist.run_commands()
File "C:msys64mingw64libpython3.9distutilsdist.py", line 966, in run_commands
self.run_command(cmd)
File "C:msys64mingw64libpython3.9distutilsdist.py", line 985, in run_command
cmd_obj.run()
File "C:UsersZenBookAppDataLocalTemppip-build-env-2iw3wr9ooverlaylibpython3.9site-packagessetuptoolscommanddist_info.py", line 31, in run
egg_info.run()
File "C:UsersZenBookAppDataLocalTemppip-install-umn76yiznumpy_f76fed0aa6fd429dbfd840b2dced598cnumpydistutilscommandegg_info.py", line 24, in run
self.run_command("build_src")
File "C:msys64mingw64libpython3.9distutilscmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:msys64mingw64libpython3.9distutilsdist.py", line 985, in run_command
cmd_obj.run()
File "C:UsersZenBookAppDataLocalTemppip-install-umn76yiznumpy_f76fed0aa6fd429dbfd840b2dced598cnumpydistutilscommandbuild_src.py", line 144, in run
self.build_sources()
File "C:UsersZenBookAppDataLocalTemppip-install-umn76yiznumpy_f76fed0aa6fd429dbfd840b2dced598cnumpydistutilscommandbuild_src.py", line 155, in build_sources
self.build_library_sources(*libname_info)
File "C:UsersZenBookAppDataLocalTemppip-install-umn76yiznumpy_f76fed0aa6fd429dbfd840b2dced598cnumpydistutilscommandbuild_src.py", line 288, in build_library_sources
sources = self.generate_sources(sources, (lib_name, build_info))
File "C:UsersZenBookAppDataLocalTemppip-install-umn76yiznumpy_f76fed0aa6fd429dbfd840b2dced598cnumpydistutilscommandbuild_src.py", line 378, in generate_sources
source = func(extension, build_dir)
st = config_cmd.try_link('int main(void) { return 0;}')
File "C:msys64mingw64libpython3.9distutilscommandconfig.py", line 241, in try_link
self._check_compiler()
File "C:UsersZenBookAppDataLocalTemppip-install-umn76yiznumpy_f76fed0aa6fd429dbfd840b2dced598cnumpydistutilscommandconfig.py", line 80, in _check_compiler
self.fcompiler = new_fcompiler(compiler=self.fcompiler,
File "C:UsersZenBookAppDataLocalTemppip-install-umn76yiznumpy_f76fed0aa6fd429dbfd840b2dced598cnumpydistutilsfcompiler__init__.py", line 876, in new_fcompiler
File "C:UsersZenBookAppDataLocalTemppip-install-umn76yiznumpy_f76fed0aa6fd429dbfd840b2dced598cnumpydistutilsfcompiler__init__.py", line 777, in load_all_fcompiler_classes
__import__ (module_name)
File "C:UsersZenBookAppDataLocalTemppip-install-umn76yiznumpy_f76fed0aa6fd429dbfd840b2dced598cnumpydistutilsfcompilercompaq.py", line 54, in <module>
class CompaqVisualFCompiler(FCompiler):
File "C:UsersZenBookAppDataLocalTemppip-install-umn76yiznumpy_f76fed0aa6fd429dbfd840b2dced598cnumpydistutilsfcompilercompaq.py", line 83, in CompaqVisualFCompiler
if '_MSVCCompiler__root' in str(msg):
NameError: name 'msg' is not defined
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
Encountered error while generating package metadata.
See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.

通过IDE (PyCharm)安装也失败。我想我缺了什么东西。在搜索了类似的问题(它们大多是针对Mac和Ubantu的)之后,我尝试安装numpy。它也失败了,错误是"为numpy"构建轮子失败";(我不会张贴所有的文本,除非必要,因为它真的很长)。从上面的文字我猜我需要mkl_rt, blis和一些东西,但我真的不知道该安装什么,我不记得我在全球安装熊猫时遇到过这种问题(它工作得很好)。我升级了pip,我有python v. 3.9,所以我真的不知道下一步该怎么做。乌利希期刊指南。安装setuptools。现在我有另一个问题了。

Collecting pandas
Using cached pandas-1.5.2.tar.gz (5.2 MB)
Installing build dependencies ... error
error: subprocess-exited-with-error
× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> [71 lines of output]
Collecting setuptools>=51.0.0
Using cached setuptools-65.6.3-py3-none-any.whl (1.2 MB)
Collecting wheel
Using cached wheel-0.38.4-py3-none-any.whl (36 kB)
Collecting Cython<3,>=0.29.32
Using cached Cython-0.29.32-py2.py3-none-any.whl (986 kB)
Collecting oldest-supported-numpy>=2022.8.16
Using cached oldest_supported_numpy-2022.11.19-py3-none-any.whl (4.9 kB)
Collecting numpy==1.19.3
Using cached numpy-1.19.3.zip (7.3 MB)
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'error'
error: subprocess-exited-with-error
Getting requirements to build wheel did not run successfully.
exit code: 1
[40 lines of output]
Traceback (most recent call last):
File "C:django.vkrlibpython3.9site-packagespip_vendorpep517in_process_in_process.py", line 351, in <module>
main()
File "C:django.vkrlibpython3.9site-packagespip_vendorpep517in_process_in_process.py", line 333, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "C:django.vkrlibpython3.9site-packagespip_vendorpep517in_process_in_process.py", line 112, in get_requires_for_build_wheel
backend = _build_backend()
File "C:django.vkrlibpython3.9site-packagespip_vendorpep517in_process_in_process.py", line 77, in _build_backend
obj = import_module(mod_path)
File "C:msys64mingw64libpython3.9importlib__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 972, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 850, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "C:UsersZenBookAppDataLocalTemppip-build-env-3fjiq_ztoverlaylibpython3.9site-packagessetuptools__init__.py", line 253, in <module>
monkey.patch_all()
File "C:UsersZenBookAppDataLocalTemppip-build-env-3fjiq_ztoverlaylibpython3.9site-packagessetuptoolsmonkey.py", line 101, in patch_all
patch_for_msvc_specialized_compiler()
File "C:UsersZenBookAppDataLocalTemppip-build-env-3fjiq_ztoverlaylibpython3.9site-packagessetuptoolsmonkey.py", line 164, in patch_for_msvc_specialized_compiler
patch_func(*msvc9('find_vcvarsall'))
File "C:UsersZenBookAppDataLocalTemppip-build-env-3fjiq_ztoverlaylibpython3.9site-packagessetuptoolsmonkey.py", line 151, in patch_params
mod = import_module(mod_name)
File "C:msys64mingw64libpython3.9importlib__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 850, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "C:UsersZenBookAppDataLocalTemppip-build-env-3fjiq_ztoverlaylibpython3.9site-packagessetuptools_distutilsmsvc9compiler.py", line 295, in <module>
raise DistutilsPlatformError("VC %0.1f is not supported by this module" % VERSION)
distutils.errors.DistutilsPlatformError: VC 6.0 is not supported by this module
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
Getting requirements to build wheel did not run successfully.
exit code: 1
See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.

对我来说总是有效的一件事是作为管理员运行命令提示符。如果你使用的是windows操作系统,只需按windows键,搜索"命令提示符",然后选择"以管理员身份运行"。然后试着运行你的命令。

这可能不是解决你的问题,但它似乎总是为我工作。

我希望这对你有帮助!

我重新安装了phyton,检查了我的路径。然后我通过PyCharm创建了虚拟环境(在我通过命令提示符创建它之前),按照YouTube视频的说明,它解决了我的问题。

最新更新