Ошибка при установке pandas для python 3.7.12

#python #python-3.x #macos #pip #virtualenv

#питон #python-3.x #macos #зернышко #virtualenv

Вопрос:

Контекст:

Я использую совершенно новый MacBook pro с M1 pro, у него macOS Monterey 12.0, ему всего неделя.

Я установил pyenv с помощью brew, а затем установил версию 3.7.12, я хотел создать venv и установить панд внутри нее, но по ошибке я начал устанавливать ее на pyenv версию 3.7.12 без venv созданной. Когда он выполнял установку, и я понял, что нажал Command C и остановился.

После этого я создал venv «cosa5» и попытался установить его, но он показал мне следующую ошибку:

 (cosa5) matiasnavarrete@MacBook-Pro-de-Matias codetest % pip install pandas Collecting pandas  Using cached pandas-1.3.4.tar.gz (4.7 MB)  Installing build dependencies ... error  ERROR: Command errored out with exit status 1:  command: /Users/matiasnavarrete/Desktop/codetest/cosa5/bin/python /Users/matiasnavarrete/Desktop/codetest/cosa5/lib/python3.7/site-packages/pip install --ignore-installed --no-user --prefix /private/var/folders/4p/syttjfhj7896l__s3gtxnxkm0000gn/T/pip-build-env-44pq47ee/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'setuptoolsgt;=51.0.0' wheel 'Cythongt;=0.29.24,lt;3' 'oldest-supported-numpygt;=0.10'  cwd: None  Complete output (29 lines):  Collecting setuptoolsgt;=51.0.0  Using cached setuptools-59.4.0-py3-none-any.whl (952 kB)  Collecting wheel  Using cached wheel-0.37.0-py2.py3-none-any.whl (35 kB)  Collecting Cythonlt;3,gt;=0.29.24  Using cached Cython-0.29.24-py2.py3-none-any.whl (979 kB)  Collecting oldest-supported-numpygt;=0.10  Using cached oldest_supported_numpy-0.12-py3-none-any.whl (3.8 kB)  Collecting numpy==1.14.5; python_version == "3.7" and platform_machine != "aarch64" and platform_system != "AIX" and platform_python_implementation != "PyPy"  Using cached numpy-1.14.5.zip (4.9 MB)  ERROR: Command errored out with exit status 1:  command: /Users/matiasnavarrete/Desktop/codetest/cosa5/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/4p/syttjfhj7896l__s3gtxnxkm0000gn/T/pip-install-r3mgeudj/numpy/setup.py'"'"'; __file__='"'"'/private/var/folders/4p/syttjfhj7896l__s3gtxnxkm0000gn/T/pip-install-r3mgeudj/numpy/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/4p/syttjfhj7896l__s3gtxnxkm0000gn/T/pip-pip-egg-info-h4uqe4mm  cwd: /private/var/folders/4p/syttjfhj7896l__s3gtxnxkm0000gn/T/pip-install-r3mgeudj/numpy/  Complete output (11 lines):  Traceback (most recent call last):  File "lt;stringgt;", line 1, in lt;modulegt;  File "/Users/matiasnavarrete/Desktop/codetest/cosa5/lib/python3.7/site-packages/setuptools/__init__.py", line 19, in lt;modulegt;  from setuptools.dist import Distribution  File "/Users/matiasnavarrete/Desktop/codetest/cosa5/lib/python3.7/site-packages/setuptools/dist.py", line 34, in lt;modulegt;  from setuptools import windows_support  File "/Users/matiasnavarrete/Desktop/codetest/cosa5/lib/python3.7/site-packages/setuptools/windows_support.py", line 2, in lt;modulegt;  import ctypes  File "/Users/matiasnavarrete/.pyenv/versions/3.7.12/lib/python3.7/ctypes/__init__.py", line 7, in lt;modulegt;  from _ctypes import Union, Structure, Array  ModuleNotFoundError: No module named '_ctypes'  ----------------------------------------  ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.  WARNING: You are using pip version 20.1.1; however, version 21.3.1 is available.  You should consider upgrading via the '/Users/matiasnavarrete/Desktop/codetest/cosa5/bin/python -m pip install --upgrade pip' command.  ---------------------------------------- ERROR: Command errored out with exit status 1: /Users/matiasnavarrete/Desktop/codetest/cosa5/bin/python /Users/matiasnavarrete/Desktop/codetest/cosa5/lib/python3.7/site-packages/pip install --ignore-installed --no-user --prefix /private/var/folders/4p/syttjfhj7896l__s3gtxnxkm0000gn/T/pip-build-env-44pq47ee/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'setuptoolsgt;=51.0.0' wheel 'Cythongt;=0.29.24,lt;3' 'oldest-supported-numpygt;=0.10' Check the logs for full command output. WARNING: You are using pip version 20.1.1; however, version 21.3.1 is available. You should consider upgrading via the '/Users/matiasnavarrete/Desktop/codetest/cosa5/bin/python -m pip install --upgrade pip' command.  

Я не знаю, связан ли тот факт, что я остановил его, с ошибкой или нет, но я все равно упомянул об этом.

Попытался удалить 3.7.12 из pyenv , установить его снова, создать новый venv , но он продолжает показывать ту же ошибку.

После этого я установил 3.9.9, создал venv и установил pandas, и у меня не было проблем с этой версией. Именно 3.7.12 продолжает доставлять мне проблемы.

Вопрос: Как я могу это исправить?

Комментарии:

1. Зачем вам конкретно нужен Python 3.7.12?

2. Просто потому, что я пробовал pyenv и среду, пытаясь научиться использовать разные версии, но, оказывается, я ее сломал. Должен быть способ это исправить