如何使用`python setup.py build`解决C ++ / C编译期间的“冲突类型”错误?

     2023-03-23     115

关键词:

【中文标题】如何使用`python setup.py build`解决C ++ / C编译期间的“冲突类型”错误?【英文标题】:How to resolve a "conflicting types" error during C++/C compilation using `python setup.py build`? 【发布时间】:2013-12-26 02:55:54 【问题描述】:

我正在尝试将 COLLADA DOM 库作为外部依赖项包含到我正在开发的程序 (PyMOL) 中,最终目标是能够以 COLLADA (.dae) 格式导出 3D 场景。我能够成功编译所有内容,直到将#include <Collada14Dom/dae.h> 添加到相关源文件中;即,如果我注释掉那一行,一切都很好。我正在使用 Xcode 5 运行 10.8.5 的 Mac。

到目前为止,我已经从 Sourceforge 安装了 COLLADA DOM v2.2,通过 make(从“dom”子目录中)构建了 DOM,并通过 @987654328 将框架安装到 /Library/Frameworks/Collada14Dom.framework @。

我还下载了Boost v1.55.0 并通过./bootstrap./b2./b2 install 安装,如here 所示。

在我的COLLADA.cpp 文件中添加以下行后编译时出现问题。

#include <Collada14Dom/dae.h>

在编译时,我得到了一系列“冲突类型”的错误:

$ sudo /sw/bin/python setup.py build install --home=/opt/pymol --install-lib=/opt/pymol/modules --install-scripts=/opt/pymol
Password:
running install
running build
running build_py
running build_ext
building 'pymol._cmd' extension
gcc -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -D_PYMOL_VMD_PLUGINS -D_PYMOL_LIBPNG -D_PYMOL_FREETYPE -D_PYMOL_INLINE -D_PYMOL_OPENGL_SHADERS -DNO_MMLIBS -D_PYMOL_CGO_DRAWARRAYS -D_PYMOL_CGO_DRAWBUFFERS -D_CGO_DRAWARRAYS -D_PYMOL_GL_CALLLISTS -DOPENGL_ES_2 -D_PYMOL_COLLADA -D_PYMOL_NUMPY -Iov/src -Ilayer0 -Ilayer1 -Ilayer2 -Ilayer3 -Ilayer4 -Ilayer5 -Imodules/cealign/src -Imodules/cealign/src/tnt -Ibuild/generated -Icontrib/uiuc/plugins/include -Icontrib/uiuc/plugins/molfile_plugin/src -I/sw/lib/python2.7/site-packages/numpy/core/include -I/usr/include -I/usr/X11/include -I/usr/X11/include/freetype2 -I/sw/include -I/sw/include/freetype2 -I/sw/include/python2.7 -c layer1/COLLADA.cpp -o build/temp.macosx-10.8-x86_64-2.7/layer1/COLLADA.o -ffast-math -funroll-loops -O3 -fcommon
In file included from layer1/COLLADA.cpp:35:
In file included from /Library/Frameworks/Collada14Dom.framework/Headers/dae.h:28:
In file included from /usr/local/include/boost/filesystem/convenience.hpp:22:
In file included from /usr/local/include/boost/filesystem/operations.hpp:25:
In file included from /usr/local/include/boost/filesystem/path.hpp:25:
In file included from /usr/local/include/boost/filesystem/path_traits.hpp:23:
In file included from /usr/local/include/boost/system/error_code.hpp:17:
In file included from /usr/local/include/boost/operators.hpp:86:
In file included from /usr/local/include/boost/iterator.hpp:17:
In file included from /usr/include/c++/4.2.1/iterator:67:
/usr/include/c++/4.2.1/bits/stl_iterator_base_funcs.h:91:5: error: conflicting types for '__distance'
    __distance(_RandomAccessIterator __first, _RandomAccessIterator __last,
    ^
/usr/include/c++/4.2.1/bits/stl_iterator_base_funcs.h:74:5: note: previous definition is here
    __distance(_InputIterator __first, _InputIterator __last,
    ^
/usr/include/c++/4.2.1/bits/stl_iterator_base_funcs.h:133:5: error: conflicting types for '__advance'
    __advance(_BidirectionalIterator& __i, _Distance __n,
    ^
/usr/include/c++/4.2.1/bits/stl_iterator_base_funcs.h:123:5: note: previous definition is here
    __advance(_InputIterator& __i, _Distance __n, input_iterator_tag)
    ^
/usr/include/c++/4.2.1/bits/stl_iterator_base_funcs.h:149:5: error: conflicting types for '__advance'
    __advance(_RandomAccessIterator& __i, _Distance __n,
    ^
/usr/include/c++/4.2.1/bits/stl_iterator_base_funcs.h:123:5: note: previous definition is here
    __advance(_InputIterator& __i, _Distance __n, input_iterator_tag)
    ^
In file included from layer1/COLLADA.cpp:35:
In file included from /Library/Frameworks/Collada14Dom.framework/Headers/dae.h:28:
In file included from /usr/local/include/boost/filesystem/convenience.hpp:22:
In file included from /usr/local/include/boost/filesystem/operations.hpp:25:
In file included from /usr/local/include/boost/filesystem/path.hpp:25:
In file included from /usr/local/include/boost/filesystem/path_traits.hpp:23:
In file included from /usr/local/include/boost/system/error_code.hpp:17:
In file included from /usr/local/include/boost/operators.hpp:86:
In file included from /usr/local/include/boost/iterator.hpp:17:
In file included from /usr/include/c++/4.2.1/iterator:68:
In file included from /usr/include/c++/4.2.1/bits/stl_iterator.h:69:
/usr/include/c++/4.2.1/bits/cpp_type_traits.h:92:10: error: functions that differ only in their return type cannot be
      overloaded
  __two& __test_type(...);
         ^
/usr/include/c++/4.2.1/bits/cpp_type_traits.h:90:9: note: previous declaration is here
  __one __test_type(int _Tp::*);
        ^
In file included from layer1/COLLADA.cpp:35:
In file included from /Library/Frameworks/Collada14Dom.framework/Headers/dae.h:28:
In file included from /usr/local/include/boost/filesystem/convenience.hpp:22:
In file included from /usr/local/include/boost/filesystem/operations.hpp:25:
In file included from /usr/local/include/boost/filesystem/path.hpp:25:
In file included from /usr/local/include/boost/filesystem/path_traits.hpp:23:
In file included from /usr/local/include/boost/system/error_code.hpp:17:
In file included from /usr/local/include/boost/operators.hpp:86:
In file included from /usr/local/include/boost/iterator.hpp:17:
In file included from /usr/include/c++/4.2.1/iterator:68:
/usr/include/c++/4.2.1/bits/stl_iterator.h:282:5: error: conflicting types for 'operator=='
    operator==(const reverse_iterator<_Iterator>& __x,
    ^
/usr/include/c++/4.2.1/bits/stl_pair.h:96:5: note: previous definition is here
    operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
    ^
In file included from layer1/COLLADA.cpp:35:
In file included from /Library/Frameworks/Collada14Dom.framework/Headers/dae.h:28:
In file included from /usr/local/include/boost/filesystem/convenience.hpp:22:
In file included from /usr/local/include/boost/filesystem/operations.hpp:25:
In file included from /usr/local/include/boost/filesystem/path.hpp:25:
In file included from /usr/local/include/boost/filesystem/path_traits.hpp:23:
In file included from /usr/local/include/boost/system/error_code.hpp:17:
In file included from /usr/local/include/boost/operators.hpp:86:
In file included from /usr/local/include/boost/iterator.hpp:17:
In file included from /usr/include/c++/4.2.1/iterator:68:
/usr/include/c++/4.2.1/bits/stl_iterator.h:288:5: error: conflicting types for 'operator<'
    operator<(const reverse_iterator<_Iterator>& __x,
    ^
/usr/include/c++/4.2.1/bits/stl_pair.h:102:5: note: previous definition is here
    operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
    ^
In file included from layer1/COLLADA.cpp:35:
In file included from /Library/Frameworks/Collada14Dom.framework/Headers/dae.h:28:
In file included from /usr/local/include/boost/filesystem/convenience.hpp:22:
In file included from /usr/local/include/boost/filesystem/operations.hpp:25:
In file included from /usr/local/include/boost/filesystem/path.hpp:25:
In file included from /usr/local/include/boost/filesystem/path_traits.hpp:23:
In file included from /usr/local/include/boost/system/error_code.hpp:17:
In file included from /usr/local/include/boost/operators.hpp:86:
In file included from /usr/local/include/boost/iterator.hpp:17:
In file included from /usr/include/c++/4.2.1/iterator:68:
/usr/include/c++/4.2.1/bits/stl_iterator.h:294:5: error: conflicting types for 'operator!='
    operator!=(const reverse_iterator<_Iterator>& __x,
    ^
/usr/include/c++/4.2.1/bits/stl_pair.h:109:5: note: previous definition is here
    operator!=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
    ^
In file included from layer1/COLLADA.cpp:35:
In file included from /Library/Frameworks/Collada14Dom.framework/Headers/dae.h:28:
In file included from /usr/local/include/boost/filesystem/convenience.hpp:22:
In file included from /usr/local/include/boost/filesystem/operations.hpp:25:
In file included from /usr/local/include/boost/filesystem/path.hpp:25:
In file included from /usr/local/include/boost/filesystem/path_traits.hpp:23:
In file included from /usr/local/include/boost/system/error_code.hpp:17:
In file included from /usr/local/include/boost/operators.hpp:86:
In file included from /usr/local/include/boost/iterator.hpp:17:
In file included from /usr/include/c++/4.2.1/iterator:68:
/usr/include/c++/4.2.1/bits/stl_iterator.h:300:5: error: conflicting types for 'operator>'
    operator>(const reverse_iterator<_Iterator>& __x,
    ^
/usr/include/c++/4.2.1/bits/stl_pair.h:115:5: note: previous definition is here
    operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
    ^
In file included from layer1/COLLADA.cpp:35:
In file included from /Library/Frameworks/Collada14Dom.framework/Headers/dae.h:28:
In file included from /usr/local/include/boost/filesystem/convenience.hpp:22:
In file included from /usr/local/include/boost/filesystem/operations.hpp:25:
In file included from /usr/local/include/boost/filesystem/path.hpp:25:
In file included from /usr/local/include/boost/filesystem/path_traits.hpp:23:
In file included from /usr/local/include/boost/system/error_code.hpp:17:
In file included from /usr/local/include/boost/operators.hpp:86:
In file included from /usr/local/include/boost/iterator.hpp:17:
In file included from /usr/include/c++/4.2.1/iterator:68:
/usr/include/c++/4.2.1/bits/stl_iterator.h:306:5: error: conflicting types for 'operator<='
    operator<=(const reverse_iterator<_Iterator>& __x,
    ^
/usr/include/c++/4.2.1/bits/stl_pair.h:121:5: note: previous definition is here
    operator<=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
    ^
In file included from layer1/COLLADA.cpp:35:
In file included from /Library/Frameworks/Collada14Dom.framework/Headers/dae.h:28:
In file included from /usr/local/include/boost/filesystem/convenience.hpp:22:
In file included from /usr/local/include/boost/filesystem/operations.hpp:25:
In file included from /usr/local/include/boost/filesystem/path.hpp:25:
In file included from /usr/local/include/boost/filesystem/path_traits.hpp:23:
In file included from /usr/local/include/boost/system/error_code.hpp:17:
In file included from /usr/local/include/boost/operators.hpp:86:
In file included from /usr/local/include/boost/iterator.hpp:17:
In file included from /usr/include/c++/4.2.1/iterator:68:
/usr/include/c++/4.2.1/bits/stl_iterator.h:312:5: error: conflicting types for 'operator>='
    operator>=(const reverse_iterator<_Iterator>& __x,
    ^
/usr/include/c++/4.2.1/bits/stl_pair.h:127:5: note: previous definition is here
    operator>=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
    ^
In file included from layer1/COLLADA.cpp:35:
In file included from /Library/Frameworks/Collada14Dom.framework/Headers/dae.h:28:
In file included from /usr/local/include/boost/filesystem/convenience.hpp:22:
In file included from /usr/local/include/boost/filesystem/operations.hpp:25:
In file included from /usr/local/include/boost/filesystem/path.hpp:25:
In file included from /usr/local/include/boost/filesystem/path_traits.hpp:23:
In file included from /usr/local/include/boost/system/error_code.hpp:17:
In file included from /usr/local/include/boost/operators.hpp:86:
In file included from /usr/local/include/boost/iterator.hpp:17:
In file included from /usr/include/c++/4.2.1/iterator:68:
/usr/include/c++/4.2.1/bits/stl_iterator.h:332:5: error: conflicting types for 'operator=='
    operator==(const reverse_iterator<_IteratorL>& __x,
    ^
/usr/include/c++/4.2.1/bits/stl_pair.h:96:5: note: previous definition is here
    operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
    ^
In file included from layer1/COLLADA.cpp:35:
In file included from /Library/Frameworks/Collada14Dom.framework/Headers/dae.h:28:
In file included from /usr/local/include/boost/filesystem/convenience.hpp:22:
In file included from /usr/local/include/boost/filesystem/operations.hpp:25:
In file included from /usr/local/include/boost/filesystem/path.hpp:25:
In file included from /usr/local/include/boost/filesystem/path_traits.hpp:23:
In file included from /usr/local/include/boost/system/error_code.hpp:17:
In file included from /usr/local/include/boost/operators.hpp:86:
In file included from /usr/local/include/boost/iterator.hpp:17:
In file included from /usr/include/c++/4.2.1/iterator:68:
/usr/include/c++/4.2.1/bits/stl_iterator.h:338:5: error: conflicting types for 'operator<'
    operator<(const reverse_iterator<_IteratorL>& __x,
    ^
/usr/include/c++/4.2.1/bits/stl_pair.h:102:5: note: previous definition is here
    operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
    ^
In file included from layer1/COLLADA.cpp:35:
In file included from /Library/Frameworks/Collada14Dom.framework/Headers/dae.h:28:
In file included from /usr/local/include/boost/filesystem/convenience.hpp:22:
In file included from /usr/local/include/boost/filesystem/operations.hpp:25:
In file included from /usr/local/include/boost/filesystem/path.hpp:25:
In file included from /usr/local/include/boost/filesystem/path_traits.hpp:23:
In file included from /usr/local/include/boost/system/error_code.hpp:17:
In file included from /usr/local/include/boost/operators.hpp:86:
In file included from /usr/local/include/boost/iterator.hpp:17:
In file included from /usr/include/c++/4.2.1/iterator:68:
/usr/include/c++/4.2.1/bits/stl_iterator.h:344:5: error: conflicting types for 'operator!='
    operator!=(const reverse_iterator<_IteratorL>& __x,
    ^
/usr/include/c++/4.2.1/bits/stl_pair.h:109:5: note: previous definition is here
    operator!=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
    ^
In file included from layer1/COLLADA.cpp:35:
In file included from /Library/Frameworks/Collada14Dom.framework/Headers/dae.h:28:
In file included from /usr/local/include/boost/filesystem/convenience.hpp:22:
In file included from /usr/local/include/boost/filesystem/operations.hpp:25:
In file included from /usr/local/include/boost/filesystem/path.hpp:25:
In file included from /usr/local/include/boost/filesystem/path_traits.hpp:23:
In file included from /usr/local/include/boost/system/error_code.hpp:17:
In file included from /usr/local/include/boost/operators.hpp:86:
In file included from /usr/local/include/boost/iterator.hpp:17:
In file included from /usr/include/c++/4.2.1/iterator:68:
/usr/include/c++/4.2.1/bits/stl_iterator.h:350:5: error: conflicting types for 'operator>'
    operator>(const reverse_iterator<_IteratorL>& __x,
    ^
/usr/include/c++/4.2.1/bits/stl_pair.h:115:5: note: previous definition is here
    operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
    ^
In file included from layer1/COLLADA.cpp:35:
In file included from /Library/Frameworks/Collada14Dom.framework/Headers/dae.h:28:
In file included from /usr/local/include/boost/filesystem/convenience.hpp:22:
In file included from /usr/local/include/boost/filesystem/operations.hpp:25:
In file included from /usr/local/include/boost/filesystem/path.hpp:25:
In file included from /usr/local/include/boost/filesystem/path_traits.hpp:23:
In file included from /usr/local/include/boost/system/error_code.hpp:17:
In file included from /usr/local/include/boost/operators.hpp:86:
In file included from /usr/local/include/boost/iterator.hpp:17:
In file included from /usr/include/c++/4.2.1/iterator:68:
/usr/include/c++/4.2.1/bits/stl_iterator.h:356:5: error: conflicting types for 'operator<='
    operator<=(const reverse_iterator<_IteratorL>& __x,
    ^
/usr/include/c++/4.2.1/bits/stl_pair.h:121:5: note: previous definition is here
    operator<=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
    ^
In file included from layer1/COLLADA.cpp:35:
In file included from /Library/Frameworks/Collada14Dom.framework/Headers/dae.h:28:
In file included from /usr/local/include/boost/filesystem/convenience.hpp:22:
In file included from /usr/local/include/boost/filesystem/operations.hpp:25:
In file included from /usr/local/include/boost/filesystem/path.hpp:25:
In file included from /usr/local/include/boost/filesystem/path_traits.hpp:23:
In file included from /usr/local/include/boost/system/error_code.hpp:17:
In file included from /usr/local/include/boost/operators.hpp:86:
In file included from /usr/local/include/boost/iterator.hpp:17:
In file included from /usr/include/c++/4.2.1/iterator:68:
/usr/include/c++/4.2.1/bits/stl_iterator.h:362:5: error: conflicting types for 'operator>='
    operator>=(const reverse_iterator<_IteratorL>& __x,
    ^
/usr/include/c++/4.2.1/bits/stl_pair.h:127:5: note: previous definition is here
    operator>=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
    ^
In file included from layer1/COLLADA.cpp:35:
In file included from /Library/Frameworks/Collada14Dom.framework/Headers/dae.h:28:
In file included from /usr/local/include/boost/filesystem/convenience.hpp:22:
In file included from /usr/local/include/boost/filesystem/operations.hpp:25:
In file included from /usr/local/include/boost/filesystem/path.hpp:25:
In file included from /usr/local/include/boost/filesystem/path_traits.hpp:23:
In file included from /usr/local/include/boost/system/error_code.hpp:17:
In file included from /usr/local/include/boost/operators.hpp:86:
In file included from /usr/local/include/boost/iterator.hpp:17:
In file included from /usr/include/c++/4.2.1/iterator:68:
/usr/include/c++/4.2.1/bits/stl_iterator.h:368:5: error: conflicting types for 'operator-'
    operator-(const reverse_iterator<_IteratorL>& __x,
    ^
/usr/include/c++/4.2.1/bits/stl_iterator.h:318:5: note: previous definition is here
    operator-(const reverse_iterator<_Iterator>& __x,
    ^
/usr/include/c++/4.2.1/bits/stl_iterator.h:738:5: error: conflicting types for 'operator=='
    operator==(const __normal_iterator<_Iterator, _Container>& __lhs,
    ^
/usr/include/c++/4.2.1/bits/stl_iterator.h:732:5: note: previous definition is here
    operator==(const __normal_iterator<_IteratorL, _Container>& __lhs,
    ^
/usr/include/c++/4.2.1/bits/stl_iterator.h:750:5: error: conflicting types for 'operator!='
    operator!=(const __normal_iterator<_Iterator, _Container>& __lhs,
    ^
/usr/include/c++/4.2.1/bits/stl_iterator.h:744:5: note: previous definition is here
    operator!=(const __normal_iterator<_IteratorL, _Container>& __lhs,
    ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
error: command 'gcc' failed with exit status 1

显然 GCC 的 C++ 头文件存在问题,但我不确定如何解决。

一个重要的考虑因素是项目代码库中没有其他 C++ 代码。 (没有基于 C 的 COLLADA 库,我真的不想在这里重新发明***。)所以似乎需要进行一些配置——也许是 setup.py 中的一些设置。有没有办法告诉setup.py使用GCC以外的东西来编译?

对于它的价值,我可以使用以下内容完全重现该问题(在安装 COLLADA DOM 和 Boost 之后):

sscce.cpp:

#ifdef __cplusplus
extern "C" 
#endif

#include <Collada14Dom/dae.h>

int main()
    return 0


#ifdef __cplusplus
  // END extern "C"
#endif

如果我尝试使用gcc sscce.cpp 构建,则会产生与完整程序相同类型的“冲突类型”错误。奇怪的是(对我来说,无论如何),我使用g++ sscce.cpp 也遇到了同样的错误,所以我想这可能不是严格意义上的 GCC 问题。

我错过了什么?希望有人以前见过这种东西,并且您实际上不必安装 COLLADA DOM 和 Boost 即可提供建议,因为这两个库都需要一些时间来构建。一如既往,我们将不胜感激。

谢谢!

【问题讨论】:

为什么要在extern "C" 块中包含看似C++ 的标头? 从您的代码中删除 extern "C' 块。 删除这些块后,我现在遇到了与在 Collada DOM 框架内的子文件夹中查找包含相关的不同错误,但“冲突类型”错误消失了。这个 C++ 文件中的函数需要被项目中的其他 C 代码调用,所以我的印象是我需要将 C++ 代码包含在 extern "C" 块中以避免名称混淆。不是这样吗? 【参考方案1】:

此 C++ 文件中的函数需要可由其他 C 代码调用 项目,所以我的印象是我需要附上 C++ extern "C" 块中的代码以避免名称混淆。那不是 案例?

extern "C" 块允许将 C 声明嵌入到 C++ 代码中,而您希望相反;对此没有任何规定。

【讨论】:

在 CMake 中使用 setup.py 构建 python 包

...述】:编辑:这个问题有点太长了。这是我真正的问题:如何在CMake中使用setuptools(setup.py)构建和安装python包?我的代码的详细信息如下所示(但使用源外构建方法,带有源的方法是有效的)。我有一个项目需要分发我自己的 查看详情

如何从“python setup.py test”运行 unittest discover?

】如何从“pythonsetup.pytest”运行unittestdiscover?【英文标题】:Howtorununittestdiscoverfrom"pythonsetup.pytest"?【发布时间】:2013-06-0418:12:39【问题描述】:我试图弄清楚如何让pythonsetup.pytest运行相当于python-munittestdiscover。我不想使... 查看详情

如何使用`python setup.py build`解决C ++ / C编译期间的“冲突类型”错误?

】如何使用`pythonsetup.pybuild`解决C++/C编译期间的“冲突类型”错误?【英文标题】:Howtoresolvea"conflictingtypes"errorduringC++/Ccompilationusing`pythonsetup.pybuild`?【发布时间】:2013-12-2602:55:54【问题描述】:我正在尝试将COLLADADOM库作... 查看详情

如何在 setup.py 中包含 git 依赖项以进行 pip 安装

】如何在setup.py中包含git依赖项以进行pip安装【英文标题】:Howtoincludegitdependenciesinsetup.pyforpipinstallation【发布时间】:2017-02-2504:39:05【问题描述】:我需要在我的Python(2.7)包中包含可通过公共Github存储库获得的Python包。我的包应... 查看详情

在 setup.py 中使用额外的 python 包索引 url

】在setup.py中使用额外的python包索引url【英文标题】:Usinganextrapythonpackageindexurlwithsetup.py【发布时间】:2014-08-1801:51:21【问题描述】:有没有办法将额外的Python包索引(alapip--extra-index-urlpypi.example.orgmypackage)与setup.py一起使用,以便... 查看详情

怎么安装python模块,如何安装python模块,常用安装方式

参考技术APython模块安装一、单文件模块直接把文件拷贝到$python_dir/Lib二、多文件模块,带setup.pypythonsetup.pyinstall三、egg文件1)下载ez_setup.py,运行pythonez_setup2)easy_install*.egg注:虽然Python的模块可以拷贝安装,但是一般情况下推荐制... 查看详情

python setup.py - 如何在安装后显示消息

】pythonsetup.py-如何在安装后显示消息【英文标题】:pythonsetup.py-howtoshowmessageafterinstall【发布时间】:2016-12-2009:05:58【问题描述】:我正在开发一个PyQt5应用程序并通过pipinstall提供它,现在python3中的pip可以安装pyqt5作为依赖项。... 查看详情

setup.py 中的 Python 包名称与 pip 名称

...:当我在setup.py文件的install_requires条目中列出依赖项时,如何指定要安装给定的包,必须将不同的名称传递给pip而不是包名称?例如,我可以使用pip安装pyintervalfromPyPI,然后我可以通过fromin 查看详情

如何在 Python 的 setup.py 中包含和安装本地依赖项?

】如何在Python的setup.py中包含和安装本地依赖项?【英文标题】:Howtoincludeandinstalllocaldependenciesinsetup.pyinPython?【发布时间】:2016-06-1015:31:52【问题描述】:我正在创建一个setup.py来分发我的应用程序。该应用程序有许多可以通过p... 查看详情

如何在 Python setup.py 中递归添加包数据?

】如何在Pythonsetup.py中递归添加包数据?【英文标题】:HowtoaddpackagedatarecursivelyinPythonsetup.py?【发布时间】:2015-02-2404:49:38【问题描述】:我有一个新库,其中必须包含许多小数据文件的子文件夹,我正在尝试将它们添加为包数... 查看详情

如何让`setup.py test`在Windows上与`multiprocessing`一起工作?

】如何让`setup.pytest`在Windows上与`multiprocessing`一起工作?【英文标题】:Howtoget`setup.pytest`workingwith`multiprocessing`onWindows?【发布时间】:2018-09-2415:39:13【问题描述】:问题我正在尝试让setup.pytest使用在Windows上使用多处理的包。我有... 查看详情

让 sphinx 使用 setup.py 中的版本

...被问及项目的版本。我想避免我的项目版本有两个位置。如何在python打包世界中做到这一点?【问题讨论】:那么,是否有任何答案对您有用?如果是这样,请接受相应的答案。如果不是,那是什么问题?感谢您的提问。我对 查看详情

setup.py:限制python解释器的允许版本

...描述】:我有一个Python库。不幸的是,我还没有更新它以使用Python3。在其setup.py中,我添加了install_requires=[\'python<3\'],我的意图是不允许在Py 查看详情

如何使用 setup.py 安装托管在私有 PyPI 中的包?

】如何使用setup.py安装托管在私有PyPI中的包?【英文标题】:HowcanIinstallpackageshostedinaprivatePyPIusingsetup.py?【发布时间】:2013-09-2015:35:13【问题描述】:我正在尝试为一个私有项目编写setup.py安装文件,该项目同时具有公共和私有... 查看详情

如何在不使用 setup.py 文件的情况下构建源代码分发?

】如何在不使用setup.py文件的情况下构建源代码分发?【英文标题】:Howtobuildasourcedistributionwithoutusingsetup.pyfile?【发布时间】:2020-03-0408:14:15【问题描述】:采用如下封装结构.├──my_package│└──__init__.py├──setup.cfg└──... 查看详情

如何使用 setuptools 和 setup.py 从包中排除单个文件

】如何使用setuptools和setup.py从包中排除单个文件【英文标题】:Howtoexcludeasinglefilefrompackagewithsetuptoolsandsetup.py【发布时间】:2016-05-0900:57:37【问题描述】:我正在处理blowdrycss。存储库是here。我希望将blowdrycss_settings.py的设置文件... 查看详情

从 setup.py 检索 python 模块自己的版本 [重复]

...布时间】:2018-02-0802:19:39【问题描述】:我正在根目录中使用标准setup.py编写基于Flask的模块:#!/usr/bin/envpythonfromdistutils.coreimportsetupsetup(name=modul 查看详情

Python setup.py:如何让 find_packages() 识别子目录中的包

】Pythonsetup.py:如何让find_packages()识别子目录中的包【英文标题】:Pythonsetup.py:Howtogetfind_packages()toidentifypackagesinsubdirectories【发布时间】:2019-06-2303:35:47【问题描述】:我正在尝试创建一个setup.py文件,其中find_packages()递归地查... 查看详情