我正在自由线程 python 中尝试 pandas。根据pandas文档,pandas==2.2.3可以在python3.13中使用。
我在Windows11上安装了python3.13并创建了虚拟环境。
python3.13t -m venv myenv
myenv\Scripts\activate
然后,在venv中我安装并导入了pandas==2.2.3,但是python退出了,没有任何输出。
(myenv) E:\>pip install pandas==2.2.3
Collecting pandas==2.2.3
Using cached pandas-2.2.3-cp313-cp313t-win_amd64.whl
Collecting numpy>=1.26.0 (from pandas==2.2.3)
Using cached numpy-2.1.3-cp313-cp313t-win_amd64.whl.metadata (60 kB)
Collecting python-dateutil>=2.8.2 (from pandas==2.2.3)
Using cached python_dateutil-2.9.0.post0-py2.py3-none-any.whl.metadata (8.4 kB)
Collecting pytz>=2020.1 (from pandas==2.2.3)
Using cached pytz-2024.2-py2.py3-none-any.whl.metadata (22 kB)
Collecting tzdata>=2022.7 (from pandas==2.2.3)
Using cached tzdata-2024.2-py2.py3-none-any.whl.metadata (1.4 kB)
Collecting six>=1.5 (from python-dateutil>=2.8.2->pandas==2.2.3)
Using cached six-1.16.0-py2.py3-none-any.whl.metadata (1.8 kB)
Using cached numpy-2.1.3-cp313-cp313t-win_amd64.whl (12.6 MB)
Using cached python_dateutil-2.9.0.post0-py2.py3-none-any.whl (229 kB)
Using cached pytz-2024.2-py2.py3-none-any.whl (508 kB)
Using cached tzdata-2024.2-py2.py3-none-any.whl (346 kB)
Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Installing collected packages: pytz, tzdata, six, numpy, python-dateutil, pandas
Successfully installed numpy-2.1.3 pandas-2.2.3 python-dateutil-2.9.0.post0 pytz-2024.2 six-1.16.0 tzdata-2024.2
[notice] A new release of pip is available: 24.2 -> 24.3.1
[notice] To update, run: python.exe -m pip install --upgrade pip
(myenv) E:\>python
Python 3.13.0 experimental free-threading build (tags/v3.13.0:60403a5, Oct 7 2024, 09:53:29) [MSC v.1941 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pandas
(myenv) E:\>
如何在python3.13t中正确导入pandas?
我再次尝试使用带有调试标志的 cpython 构建。这是更详细的错误日志:
(debugenv) E:\cpython\cpython-3.13.0\PCbuild\amd64>python
Python 3.13.0 experimental free-threading build (main, Nov 4 2024, 19:14:19) [MSC v.1940 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pandas
Traceback (most recent call last):
File "<python-input-0>", line 1, in <module>
import pandas
File "E:\cpython\cpython-3.13.0\PCbuild\amd64\debugenv\Lib\site-packages\pandas\__init__.py", line 49, in <module>
from pandas.core.api import (
...<62 lines>...
)
File "E:\cpython\cpython-3.13.0\PCbuild\amd64\debugenv\Lib\site-packages\pandas\core\api.py", line 1, in <module>
from pandas._libs import (
...<4 lines>...
)
File "E:\cpython\cpython-3.13.0\PCbuild\amd64\debugenv\Lib\site-packages\pandas\_libs\__init__.py", line 16, in <module>
import pandas._libs.pandas_parser # isort: skip # type: ignore[reportUnusedImport]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ImportError: DLL load failed while importing pandas_parser: The specified module could not be found.
我没有真正找到有关此错误的有用信息。