[英]Can't install pandas (and numpy) in virtual environment
所以,最近我決定嘗試在我的新 django 項目中使用 venv。 我正在學習一些教程,但現在我遇到了一個問題——我無法安裝 Pandas 包。 我通過 Windows PowerShall 安裝 django 沒有問題,但是在我嘗試使用該命令 (.vkr) 安裝 pandas 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/random\bit_generator.pyx
Processing numpy/random\mtrand.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:\Users\ZenBook\AppData\Local\Temp\pip-install-umn76yiz\numpy_f76fed0aa6fd429dbfd840b2dced598c\numpy\distutils\system_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:\Users\ZenBook\AppData\Local\Temp\pip-install-umn76yiz\numpy_f76fed0aa6fd429dbfd840b2dced598c\numpy\distutils\system_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:\Users\ZenBook\AppData\Local\Temp\pip-install-umn76yiz\numpy_f76fed0aa6fd429dbfd840b2dced598c\numpy\distutils\system_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\.vkr\lib
libraries tatlas,tatlas not found in C:\django\.vkr\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:\django\.vkr\lib
libraries satlas,satlas not found in C:\django\.vkr\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:\django\.vkr\lib
libraries ptf77blas,ptcblas,atlas not found in C:\django\.vkr\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:\django\.vkr\lib
libraries f77blas,cblas,atlas not found in C:\django\.vkr\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:\\django\\.vkr\\lib', 'C:\\']
NOT AVAILABLE
C:\Users\ZenBook\AppData\Local\Temp\pip-install-umn76yiz\numpy_f76fed0aa6fd429dbfd840b2dced598c\numpy\distutils\system_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:\Users\ZenBook\AppData\Local\Temp\pip-install-umn76yiz\numpy_f76fed0aa6fd429dbfd840b2dced598c\numpy\distutils\system_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:\msys64\mingw64\lib\python3.9\distutils\dist.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 build\src.mingw_x86_64-3.9
creating build\src.mingw_x86_64-3.9\numpy
creating build\src.mingw_x86_64-3.9\numpy\distutils
building library "npymath" sources
Traceback (most recent call last):
File "C:\Users\ZenBook\AppData\Local\Temp\pip-install-umn76yiz\numpy_f76fed0aa6fd429dbfd840b2dced598c\numpy\distutils\fcompiler\compaq.py", line 78, in CompaqVisualFCompiler
m.initialize()
File "C:\Users\ZenBook\AppData\Local\Temp\pip-install-umn76yiz\numpy_f76fed0aa6fd429dbfd840b2dced598c\numpy\distutils\msvccompiler.py", line 48, in initialize
_MSVCCompiler.initialize(self)
File "C:\msys64\mingw64\lib\python3.9\distutils\msvccompiler.py", line 259, in initialize
self.__paths = self.get_msvc_paths("path")
File "C:\msys64\mingw64\lib\python3.9\distutils\msvccompiler.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\.vkr\lib\python3.9\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 351, in <module>
main()
File "C:\django\.vkr\lib\python3.9\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 333, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "C:\django\.vkr\lib\python3.9\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 152, in prepare_metadata_for_build_wheel
return hook(metadata_directory, config_settings)
File "C:\Users\ZenBook\AppData\Local\Temp\pip-build-env-2iw3wr9o\overlay\lib\python3.9\site-packages\setuptools\build_meta.py", line 157, in prepare_metadata_for_build_wheel
self.run_setup()
File "C:\Users\ZenBook\AppData\Local\Temp\pip-build-env-2iw3wr9o\overlay\lib\python3.9\site-packages\setuptools\build_meta.py", line 248, in run_setup
super(_BuildMetaLegacyBackend,
File "C:\Users\ZenBook\AppData\Local\Temp\pip-build-env-2iw3wr9o\overlay\lib\python3.9\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 "C:\Users\ZenBook\AppData\Local\Temp\pip-install-umn76yiz\numpy_f76fed0aa6fd429dbfd840b2dced598c\numpy\distutils\core.py", line 169, in setup
return old_setup(**new_attr)
File "C:\Users\ZenBook\AppData\Local\Temp\pip-build-env-2iw3wr9o\overlay\lib\python3.9\site-packages\setuptools\__init__.py", line 165, in setup
return distutils.core.setup(**attrs)
File "C:\msys64\mingw64\lib\python3.9\distutils\core.py", line 148, in setup
dist.run_commands()
File "C:\msys64\mingw64\lib\python3.9\distutils\dist.py", line 966, in run_commands
self.run_command(cmd)
File "C:\msys64\mingw64\lib\python3.9\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\ZenBook\AppData\Local\Temp\pip-build-env-2iw3wr9o\overlay\lib\python3.9\site-packages\setuptools\command\dist_info.py", line 31, in run
egg_info.run()
File "C:\Users\ZenBook\AppData\Local\Temp\pip-install-umn76yiz\numpy_f76fed0aa6fd429dbfd840b2dced598c\numpy\distutils\command\egg_info.py", line 24, in run
self.run_command("build_src")
File "C:\msys64\mingw64\lib\python3.9\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\msys64\mingw64\lib\python3.9\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\ZenBook\AppData\Local\Temp\pip-install-umn76yiz\numpy_f76fed0aa6fd429dbfd840b2dced598c\numpy\distutils\command\build_src.py", line 144, in run
self.build_sources()
File "C:\Users\ZenBook\AppData\Local\Temp\pip-install-umn76yiz\numpy_f76fed0aa6fd429dbfd840b2dced598c\numpy\distutils\command\build_src.py", line 155, in build_sources
self.build_library_sources(*libname_info)
File "C:\Users\ZenBook\AppData\Local\Temp\pip-install-umn76yiz\numpy_f76fed0aa6fd429dbfd840b2dced598c\numpy\distutils\command\build_src.py", line 288, in build_library_sources
sources = self.generate_sources(sources, (lib_name, build_info))
File "C:\Users\ZenBook\AppData\Local\Temp\pip-install-umn76yiz\numpy_f76fed0aa6fd429dbfd840b2dced598c\numpy\distutils\command\build_src.py", line 378, in generate_sources
source = func(extension, build_dir)
st = config_cmd.try_link('int main(void) { return 0;}')
File "C:\msys64\mingw64\lib\python3.9\distutils\command\config.py", line 241, in try_link
self._check_compiler()
File "C:\Users\ZenBook\AppData\Local\Temp\pip-install-umn76yiz\numpy_f76fed0aa6fd429dbfd840b2dced598c\numpy\distutils\command\config.py", line 80, in _check_compiler
self.fcompiler = new_fcompiler(compiler=self.fcompiler,
File "C:\Users\ZenBook\AppData\Local\Temp\pip-install-umn76yiz\numpy_f76fed0aa6fd429dbfd840b2dced598c\numpy\distutils\fcompiler\__init__.py", line 876, in new_fcompiler
File "C:\Users\ZenBook\AppData\Local\Temp\pip-install-umn76yiz\numpy_f76fed0aa6fd429dbfd840b2dced598c\numpy\distutils\fcompiler\__init__.py", line 777, in load_all_fcompiler_classes
__import__ (module_name)
File "C:\Users\ZenBook\AppData\Local\Temp\pip-install-umn76yiz\numpy_f76fed0aa6fd429dbfd840b2dced598c\numpy\distutils\fcompiler\compaq.py", line 54, in <module>
class CompaqVisualFCompiler(FCompiler):
File "C:\Users\ZenBook\AppData\Local\Temp\pip-install-umn76yiz\numpy_f76fed0aa6fd429dbfd840b2dced598c\numpy\distutils\fcompiler\compaq.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 和其他東西,但我真的不知道要安裝什么,我不記得在全局安裝 pandas 時遇到過這種問題(它工作正常)。 我升級了 pip,我有 python v.3.9 所以我真的不知道下一步該做什么。 更新。 安裝了設置工具。 現在我有另一個問題。
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\.vkr\lib\python3.9\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 351, in <module>
main()
File "C:\django\.vkr\lib\python3.9\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 333, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "C:\django\.vkr\lib\python3.9\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 112, in get_requires_for_build_wheel
backend = _build_backend()
File "C:\django\.vkr\lib\python3.9\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 77, in _build_backend
obj = import_module(mod_path)
File "C:\msys64\mingw64\lib\python3.9\importlib\__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:\Users\ZenBook\AppData\Local\Temp\pip-build-env-3fjiq_zt\overlay\lib\python3.9\site-packages\setuptools\__init__.py", line 253, in <module>
monkey.patch_all()
File "C:\Users\ZenBook\AppData\Local\Temp\pip-build-env-3fjiq_zt\overlay\lib\python3.9\site-packages\setuptools\monkey.py", line 101, in patch_all
patch_for_msvc_specialized_compiler()
File "C:\Users\ZenBook\AppData\Local\Temp\pip-build-env-3fjiq_zt\overlay\lib\python3.9\site-packages\setuptools\monkey.py", line 164, in patch_for_msvc_specialized_compiler
patch_func(*msvc9('find_vcvarsall'))
File "C:\Users\ZenBook\AppData\Local\Temp\pip-build-env-3fjiq_zt\overlay\lib\python3.9\site-packages\setuptools\monkey.py", line 151, in patch_params
mod = import_module(mod_name)
File "C:\msys64\mingw64\lib\python3.9\importlib\__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:\Users\ZenBook\AppData\Local\Temp\pip-build-env-3fjiq_zt\overlay\lib\python3.9\site-packages\setuptools\_distutils\msvc9compiler.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 鍵,搜索“命令提示符”,然后選擇“以管理員身份運行”。 然后嘗試運行您的命令。
它可能不能解決您的問題,但它似乎總是對我有用。
我希望這有幫助!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.