ошибка импорта pandas/numpy с интерпретатором python3.13t.exe
пытаюсь запустить код в версии без gil в PyCharm. Если переключаю на версию с gil, все работает. В чем может быть ошибка?
import pandas as pd
def func():
pd.DataFrame({'data':[1,3], 'id':[1,2]})
func()
трейсбэк:
"F:\Installed Programs\Python 3.13.1\python3.13t.exe" "E:\проекты\свободная тренировка\main.py"
Traceback (most recent call last):
File "E:\проекты\свободная тренировка\main.py", line 1, in <module>
import pandas as pd
File "F:\Installed Programs\Python 3.13.1\Lib\site-packages\pandas\__init__.py", line 32, in <module>
raise ImportError(
"Unable to import required dependencies:\n" + "\n".join(_missing_dependencies)
)
ImportError: Unable to import required dependencies:w
numpy: Error importing numpy: you should not try to import numpy from
its source directory; please exit the numpy source tree, and relaunch
your python interpreter from there.
Process finished with exit code 1
так же ошибка в PyCharm при установке pandas через manage packages:
Ответы (2 шт):
У меня обычно подобное созданием виртуального окружения фиксится. Windows:
python -m venv <name>
python -m <name>\scripts\activate
На маке и линуксе последняя строчка будет отличаться:
source <name>/bin/activate
Удалось решить проблему с импортом библиотеки pandas через эту тему https://stackoverflow.com/questions/79162992/cannot-import-pandas-in-python3-13-free-threading-mode] "Although pandas document says it has been compatible with Python 3.13 free-threading build, it actually didn't provide coresponding wheel file for windows yet.
The error here was because that pip tried to build wheel file for python3.13t from source code, and generated a wrong wheel file.
However, in this PR you can find the right wheel file cp313t-win_arm64. You can download it from Artifacts and use python3.13t -m pip install pandas*.whl to install it in python3.13t."