python - 如何修复 python 3.7 中软件包安装 (fcm) 期间的 gcc 错误

标签 python gcc installation c-strings

最近的Python用户,我正在尝试使用fcm模块来分析流式细胞术数据( https://pythonhosted.org/fcm/ )。我在 pip 安装期间发现与“gcc”相关的错误。

尝试更新pip和setuptools,还按照How to fix gcc error produced by pip install?中的建议安装了brew和openssl ,仍然发现同样的错误。

终端输出如下:

Collecting fcm

  Downloading https://files.pythonhosted.org/packages/b8/50/92e6fcf82b3411def7c5c08a1b9be5fc4d5f4a4ae8eb7c95ee4b0485fbdd/fcm-0.9.1.tar.gz (1.1MB)
    100% |████████████████████████████████| 1.1MB 12.9MB/s

Installing collected packages: fcm

  Running setup.py install for fcm ... error

    Complete output from command /anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/kt/54_zwpj929b852yth43_hj440000gn/T/pip-install-424k_8e4/fcm/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/kt/54_zwpj929b852yth43_hj440000gn/T/pip-record-43efnrvl/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.7-x86_64-3.7
    creating build/lib.macosx-10.7-x86_64-3.7/fcm
    copying src/__init__.py -> build/lib.macosx-10.7-x86_64-3.7/fcm
    creating build/lib.macosx-10.7-x86_64-3.7/fcm/core
    copying src/core/transforms.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/core
    copying src/core/tree.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/core
    copying src/core/annotation.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/core
    copying src/core/fcmdata.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/core
    copying src/core/logicle.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/core
    copying src/core/__init__.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/core
    copying src/core/compensate.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/core
    copying src/core/gate.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/core
    copying src/core/fcmcollection.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/core
    copying src/core/fcmexceptions.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/core
    copying src/core/subsample.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/core
    creating build/lib.macosx-10.7-x86_64-3.7/fcm/graphics
    copying src/graphics/plot.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/graphics
    copying src/graphics/experimental.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/graphics
    copying src/graphics/plot_gate.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/graphics
    copying src/graphics/util.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/graphics
    copying src/graphics/__init__.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/graphics
    copying src/graphics/dimechart.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/graphics
    creating build/lib.macosx-10.7-x86_64-3.7/fcm/gui
    copying src/gui/mpl_qgate.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/gui
    copying src/gui/__init__.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/gui
    copying src/gui/mpl_gate.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/gui
    creating build/lib.macosx-10.7-x86_64-3.7/fcm/io
    copying src/io/flowjoxml.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/io
    copying src/io/__init__.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/io
    copying src/io/export_to_fcs.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/io
    copying src/io/readfcs.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/io
    creating build/lib.macosx-10.7-x86_64-3.7/fcm/statistics
    copying src/statistics/mvnpdf.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/statistics
    copying src/statistics/partition.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/statistics
    copying src/statistics/util.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/statistics
    copying src/statistics/__init__.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/statistics
    copying src/statistics/modelresult.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/statistics
    copying src/statistics/kmeans.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/statistics
    copying src/statistics/dime.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/statistics
    copying src/statistics/distributions.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/statistics
    copying src/statistics/cluster.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/statistics
    copying src/statistics/dp_cluster.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/statistics
    copying src/statistics/component.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/statistics
    running build_ext
    building 'fcm.core._logicle' extension
    creating build/temp.macosx-10.7-x86_64-3.7
    creating build/temp.macosx-10.7-x86_64-3.7/src
    creating build/temp.macosx-10.7-x86_64-3.7/src/core
    creating build/temp.macosx-10.7-x86_64-3.7/src/core/logicle_ext
    gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/anaconda3/include -arch x86_64 -I/anaconda3/include -arch x86_64 -I/anaconda3/lib/python3.7/site-packages/numpy/core/include -I/anaconda3/include/python3.7m -c src/core/logicle_ext/Logicle.cpp -o build/temp.macosx-10.7-x86_64-3.7/src/core/logicle_ext/Logicle.o
    warning: include path for stdlibc++ headers not found; pass '-stdlib=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]
    src/core/logicle_ext/Logicle.cpp:3:10: fatal error: 'cstring' file not found
    #include <cstring>
             ^~~~~~~~~
    1 warning and 1 error generated.
    error: command 'gcc' failed with exit status 1

    ----------------------------------------
Command "/anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/kt/54_zwpj929b852yth43_hj440000gn/T/pip-install-424k_8e4/fcm/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/kt/54_zwpj929b852yth43_hj440000gn/T/pip-record-43efnrvl/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/kt/54_zwpj929b852yth43_hj440000gn/T/pip-install-424k_8e4/fcm/

感谢任何进一步的建议

编辑:安装命令行工具并导出 -stdlib=libc++

Downloading https://files.pythonhosted.org/packages/b8/50/92e6fcf82b3411def7c5c08a1b9be5fc4d5f4a4ae8eb7c95ee4b0485fbdd/fcm-0.9.1.tar.gz (1.1MB)
    100% |████████████████████████████████| 1.1MB 13.3MB/s 
Installing collected packages: fcm
  Running setup.py install for fcm ... error
    Complete output from command /anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/kt/54_zwpj929b852yth43_hj440000gn/T/pip-install-p_ehtvg8/fcm/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/kt/54_zwpj929b852yth43_hj440000gn/T/pip-record-4xk1zm47/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.7-x86_64-3.7
    creating build/lib.macosx-10.7-x86_64-3.7/fcm
    copying src/__init__.py -> build/lib.macosx-10.7-x86_64-3.7/fcm
    creating build/lib.macosx-10.7-x86_64-3.7/fcm/core
    copying src/core/transforms.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/core
    copying src/core/tree.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/core
    copying src/core/annotation.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/core
    copying src/core/fcmdata.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/core
    copying src/core/logicle.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/core
    copying src/core/__init__.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/core
    copying src/core/compensate.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/core
    copying src/core/gate.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/core
    copying src/core/fcmcollection.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/core
    copying src/core/fcmexceptions.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/core
    copying src/core/subsample.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/core
    creating build/lib.macosx-10.7-x86_64-3.7/fcm/graphics
    copying src/graphics/plot.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/graphics
    copying src/graphics/experimental.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/graphics
    copying src/graphics/plot_gate.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/graphics
    copying src/graphics/util.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/graphics
    copying src/graphics/__init__.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/graphics
    copying src/graphics/dimechart.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/graphics
    creating build/lib.macosx-10.7-x86_64-3.7/fcm/gui
    copying src/gui/mpl_qgate.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/gui
    copying src/gui/__init__.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/gui
    copying src/gui/mpl_gate.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/gui
    creating build/lib.macosx-10.7-x86_64-3.7/fcm/io
    copying src/io/flowjoxml.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/io
    copying src/io/__init__.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/io
    copying src/io/export_to_fcs.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/io
    copying src/io/readfcs.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/io
    creating build/lib.macosx-10.7-x86_64-3.7/fcm/statistics
    copying src/statistics/mvnpdf.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/statistics
    copying src/statistics/partition.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/statistics
    copying src/statistics/util.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/statistics
    copying src/statistics/__init__.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/statistics
    copying src/statistics/modelresult.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/statistics
    copying src/statistics/kmeans.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/statistics
    copying src/statistics/dime.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/statistics
    copying src/statistics/distributions.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/statistics
    copying src/statistics/cluster.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/statistics
    copying src/statistics/dp_cluster.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/statistics
    copying src/statistics/component.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/statistics
    running build_ext
    building 'fcm.core._logicle' extension
    creating build/temp.macosx-10.7-x86_64-3.7
    creating build/temp.macosx-10.7-x86_64-3.7/src
    creating build/temp.macosx-10.7-x86_64-3.7/src/core
    creating build/temp.macosx-10.7-x86_64-3.7/src/core/logicle_ext
    gcc -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -stdlib=libc++ -I/anaconda3/lib/python3.7/site-packages/numpy/core/include -I/anaconda3/include/python3.7m -c src/core/logicle_ext/Logicle.cpp -o build/temp.macosx-10.7-x86_64-3.7/src/core/logicle_ext/Logicle.o
    src/core/logicle_ext/Logicle.cpp:290:4: warning: add explicit braces to avoid dangling else [-Wdangling-else]
                            else
                            ^
    1 warning generated.
    gcc -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -stdlib=libc++ -I/anaconda3/lib/python3.7/site-packages/numpy/core/include -I/anaconda3/include/python3.7m -c src/core/logicle_ext/my_logicle.cpp -o build/temp.macosx-10.7-x86_64-3.7/src/core/logicle_ext/my_logicle.o
    gcc -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -stdlib=libc++ -I/anaconda3/lib/python3.7/site-packages/numpy/core/include -I/anaconda3/include/python3.7m -c src/core/logicle_ext/my_logicle_wrapper.cpp -o build/temp.macosx-10.7-x86_64-3.7/src/core/logicle_ext/my_logicle_wrapper.o
    src/core/logicle_ext/my_logicle_wrapper.cpp:788:3: error: no matching function for call to 'PyBytes_AsStringAndSize'
      PyBytes_AsStringAndSize(str, &cstr, &len);
      ^~~~~~~~~~~~~~~~~~~~~~~
    /anaconda3/include/python3.7m/bytesobject.h:103:17: note: candidate function not viable: no known conversion from 'int *' to 'Py_ssize_t *' (aka 'long *') for 3rd argument
    PyAPI_FUNC(int) PyBytes_AsStringAndSize(
                    ^
    src/core/logicle_ext/my_logicle_wrapper.cpp:2229:11: warning: explicitly assigning value of variable of type 'int' to itself [-Wself-assign]
                        res = SWIG_AddCast(res);
                        ~~~ ^              ~~~
    src/core/logicle_ext/my_logicle_wrapper.cpp:2232:11: warning: explicitly assigning value of variable of type 'int' to itself [-Wself-assign]
                        res = SWIG_AddCast(res);
                        ~~~ ^              ~~~
    src/core/logicle_ext/my_logicle_wrapper.cpp:2454:20: error: use of undeclared identifier 'PyCObject_Import'; did you mean 'PyObject_Init'?
        type_pointer = PyCObject_Import((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION,
                       ^~~~~~~~~~~~~~~~
                       PyObject_Init
    /anaconda3/include/python3.7m/objimpl.h:130:24: note: 'PyObject_Init' declared here
    PyAPI_FUNC(PyObject *) PyObject_Init(PyObject *, PyTypeObject *);
                           ^
    src/core/logicle_ext/my_logicle_wrapper.cpp:2454:37: error: cannot initialize a parameter of type 'PyObject *' (aka '_object *') with an rvalue of type 'char *'
        type_pointer = PyCObject_Import((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION,
                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /anaconda3/include/python3.7m/objimpl.h:130:48: note: passing argument to parameter here
    PyAPI_FUNC(PyObject *) PyObject_Init(PyObject *, PyTypeObject *);
                                                   ^
    src/core/logicle_ext/my_logicle_wrapper.cpp:2524:23: error: use of undeclared identifier 'PyCObject_FromVoidPtr'
      PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, SWIG_Python_DestroyModule);
                          ^
    src/core/logicle_ext/my_logicle_wrapper.cpp:2547:37: error: use of undeclared identifier 'PyCObject_AsVoidPtr'
        descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj);
                                        ^
    src/core/logicle_ext/my_logicle_wrapper.cpp:2552:13: error: use of undeclared identifier 'PyCObject_FromVoidPtr'
          obj = PyCObject_FromVoidPtr(descriptor, NULL);
                ^
    In file included from src/core/logicle_ext/my_logicle_wrapper.cpp:2800:
    In file included from /anaconda3/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4:
    In file included from /anaconda3/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12:
    In file included from /anaconda3/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1824:
    /anaconda3/lib/python3.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: "Using deprecated NumPy API, disable it with "          "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-W#warnings]
    #warning "Using deprecated NumPy API, disable it with " \
     ^
    src/core/logicle_ext/my_logicle_wrapper.cpp:2919:9: error: use of undeclared identifier 'PyString_Check'; did you mean 'PyMapping_Check'?
        if (PyString_Check(  py_obj)) return "string"      ;
            ^~~~~~~~~~~~~~
            PyMapping_Check
    /anaconda3/include/python3.7m/abstract.h:1006:17: note: 'PyMapping_Check' declared here
    PyAPI_FUNC(int) PyMapping_Check(PyObject *o);
                    ^
    src/core/logicle_ext/my_logicle_wrapper.cpp:2925:9: error: use of undeclared identifier 'PyFile_Check'
        if (PyFile_Check(    py_obj)) return "file"        ;
            ^
    src/core/logicle_ext/my_logicle_wrapper.cpp:2927:9: error: use of undeclared identifier 'PyInstance_Check'; did you mean 'PySequence_Check'?
        if (PyInstance_Check(py_obj)) return "instance"    ;
            ^~~~~~~~~~~~~~~~
            PySequence_Check
    /anaconda3/include/python3.7m/abstract.h:838:17: note: 'PySequence_Check' declared here
    PyAPI_FUNC(int) PySequence_Check(PyObject *o);
                    ^
    src/core/logicle_ext/my_logicle_wrapper.cpp:3435:14: warning: explicitly assigning value of variable of type 'void *' to itself [-Wself-assign]
      clientdata = clientdata;
      ~~~~~~~~~~ ^ ~~~~~~~~~~
    4 warnings and 9 errors generated.
    error: command 'gcc' failed with exit status 1

    ----------------------------------------
Command "/anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/kt/54_zwpj929b852yth43_hj440000gn/T/pip-install-p_ehtvg8/fcm/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/kt/54_zwpj929b852yth43_hj440000gn/T/pip-record-4xk1zm47/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/kt/54_zwpj929b852yth43_hj440000gn/T/pip-install-p_ehtvg8/fcm/

最佳答案

如果您尝试为“django”安装“fcm”,那么您可以这样做

    pip install django-fcm

关于python - 如何修复 python 3.7 中软件包安装 (fcm) 期间的 gcc 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57075128/

相关文章:

c++ - 需要帮助查找 undefined symbol

linux - 在 Linux 中安装 vim-go?

python - 如何以编程方式在 C++ 或 Python 中列出 DLL 的依赖项?

c++ - 为什么GCC认为constexpr静态数据成员的定义必须标记为constexpr?

python - Sublime Text 3 的 REPL 错误

c++ - 错误 : typedef name may not be a nested-name-specifier

macos - 从命令行 packagemaker 指定安装位置

c# - 如何制作可打补丁/可更新的应用程序?

python - 在 Numpy 中通过模糊蒙版合成图像

python - Docker "Get Started(Python)"不工作