You need to enable JavaScript to run this app.
最新活动
大模型
产品
解决方案
定价
生态与合作
支持与服务
开发者
了解我们

Windows 11下使用pip安装ccxt包失败的问题求助

Windows 11下使用pip安装ccxt包失败的问题求助

我在Windows 11上尝试用pip install ccxt安装ccxt包,但是遇到了如下错误:

Collecting ccxt
  Downloading ccxt-4.4.40-py2.py3-none-any.whl.metadata (116 kB)
Requirement already satisfied: setuptools>=60.9.0 in c:\msys64\mingw64\lib\python3.11\site-packages (from ccxt) (75.6.0)
Requirement already satisfied: certifi>=2018.1.18 in c:\msys64\mingw64\lib\python3.11\site-packages (from ccxt) (2024.8.30)
Requirement already satisfied: requests>=2.18.4 in c:\msys64\mingw64\lib\python3.11\site-packages (from ccxt) (2.32.3)
Collecting cryptography>=2.6.1 (from ccxt)
  Using cached cryptography-44.0.0.tar.gz (710 kB)
  Installing build dependencies ... error
  error: subprocess-exited-with-error

  × pip subprocess to install build dependencies did not run successfully.
  │ exit code: 1
  ╰─> [79 lines of output]
      Collecting maturin<2,>=1
        Using cached maturin-1.7.8-cp311-cp311-mingw_x86_64.whl
      Collecting cffi>=1.12
        Using cached cffi-1.17.1.tar.gz (516 kB)
        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 'done'
      Collecting setuptools!=74.0.0,!=74.1.0,!=74.1.1,!=74.1.2
        Using cached setuptools-75.6.0-py3-none-any.whl.metadata (6.7 kB)
      Collecting pycparser (from cffi>=1.12)
        Using cached pycparser-2.22-py3-none-any.whl.metadata (943 bytes)
      Using cached setuptools-75.6.0-py3-none-any.whl (1.2 MB)
      Using cached pycparser-2.22-py3-none-any.whl (117 kB)
      Building wheels for collected packages: cffi
        Building wheel for cffi (pyproject.toml): started
        Building wheel for cffi (pyproject.toml): finished with status 'error'
        error: subprocess-exited-with-error

        Building wheel for cffi (pyproject.toml) did not run successfully.
        exit code: 1

        [48 lines of output]
        _configtest.c:2:2: error: #error "not MSVC"
            2 | #error "not MSVC"
              |  ^~~~~
        Note: will not use '__thread' in the C code
        ***** The above error message can be safely ignored.

        running bdist_wheel
        running build
        running build_py
        creating build\lib.mingw_x86_64-cpython-311\cffi
        copying src\cffi\api.py -> build\lib.mingw_x86_64-cpython-311\cffi
        copying src\cffi\backend_ctypes.py -> build\lib.mingw_x86_64-cpython-311\cffi
        copying src\cffi\cffi_opcode.py -> build\lib.mingw_x86_64-cpython-311\cffi
        copying src\cffi\commontypes.py -> build\lib.mingw_x86_64-cpython-311\cffi
        copying src\cffi\cparser.py -> build\lib.mingw_x86_64-cpython-311\cffi
        copying src\cffi\error.py -> build\lib.mingw_x86_64-cpython-311\cffi
        copying src\cffi\ffiplatform.py -> build\lib.mingw_x86_64-cpython-311\cffi
        copying src\cffi\lock.py -> build\lib.mingw_x86_64-cpython-311\cffi
        copying src\cffi\model.py -> build\lib.mingw_x86_64-cpython-311\cffi
        copying src\cffi\pkgconfig.py -> build\lib.mingw_x86_64-cpython-311\cffi
        copying src\cffi\recompiler.py -> build\lib.mingw_x86_64-cpython-311\cffi
        copying src\cffi\setuptools_ext.py -> build\lib.mingw_x86_64-cpython-311\cffi
        copying src\cffi\vengine_cpy.py -> build\lib.mingw_x86_64-cpython-311\cffi
        copying src\cffi\vengine_gen.py -> build\lib.mingw_x86_64-cpython-311\cffi
        copying src\cffi\verifier.py -> build\lib.mingw_x86_64-cpython-311\cffi
        copying src\cffi\_imp_emulation.py -> build\lib.mingw_x86_64-cpython-311\cffi
        copying src\cffi\_shimmed_dist_utils.py -> build\lib.mingw_x86_64-cpython-311\cffi
        copying src\cffi\__init__.py -> build\lib.mingw_x86_64-cpython-311\cffi
        copying src\cffi\_cffi_include.h -> build\lib.mingw_x86_64-cpython-311\cffi
        copying src\cffi\parse_c_type.h -> build\lib.mingw_x86_64-cpython-311\cffi
        copying src\cffi\_embedding.h -> build\lib.mingw_x86_64-cpython-311\cffi
        copying src\cffi\_cffi_errors.h -> build\lib.mingw_x86_64-cpython-311\cffi
        running build_ext
        building '_cffi_backend' extension
        creating build\temp.mingw_x86_64-cpython-311\src\c
        gcc -DNDEBUG -g -fwrapv -O3 -Wall -march=nocona -msahf -mtune=generic -O2 -pipe -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector-strong -O3 -march=nocona -msahf -mtune=generic -O2 -pipe -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector-strong -O3 -DFFI_BUILDING=1 -I/usr/include/ffi -I/usr/include/libffi -IC:\msys64\mingw64/include/python3.11 -c src/c/_cffi_backend.c -o build\temp.mingw_x86_64-cpython-311\src\c\_cffi_backend.o
        src/c/_cffi_backend.c: In function 'b_do_dlopen':
        src/c/_cffi_backend.c:4568:40: error: passing argument 1 of 'PyUnicode_AsWideChar' from incompatible pointer type [-Wincompatible-pointer-types]
         4568 |             sz1 = PyUnicode_AsWideChar((PyUnicodeObject *)filename_unicode,
              |                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
              |                                        |
              |                                        PyUnicodeObject *
        In file included from C:\msys64\mingw64/include/python3.11/Python.h:51,
                         from src/c/_cffi_backend.c:2:
        C:\msys64\mingw64/include/python3.11/unicodeobject.h:299:15: note: expected 'PyObject *' {aka 'struct _object *'} but argument is of type 'PyUnicodeObject *'
          299 |     PyObject *unicode,          /* Unicode object */
              |     ~~~~~~~~~~^~~~~~~
        error: command 'C:\\msys64\\mingw64\\bin\\gcc.EXE' failed with exit code 1
        [end of output]

        note: This error originates from a subprocess, and is likely not a problem with pip.
        ERROR: Failed building wheel for cffi
      Failed to build cffi
      ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (cffi)
      [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.

当前我的pip版本是pip 24.3.1,Python版本是3.11.9

我已经尝试过以下方法,但都没有解决问题:

  • 单独用pip安装cffi,遇到类似错误
  • 通过wheel安装cffi,没有成功
  • 尝试安装cryptography,同样失败
  • 执行pip install ccxt --upgrade,还是出现相同错误
  • 已经安装了Rust环境
  • 尝试在虚拟环境中执行命令,但无法访问虚拟环境
  • 安装了最新版Visual Studio,并勾选了“C++桌面开发”组件

请问有没有解决这个问题的方法?

备注:内容来源于stack exchange,提问作者samu cam

火山引擎 最新活动