当我第一次尝试安装pyopencv时
./vendor/venv/bin/pip install pyopencv
它说使用CMake有问题。
我按照here的说明在我的计算机上构建了OpenCV。我还使用Homebrew来升级python和cmake并安装boost。每一步都让我在安装过程中走得更远,但现在我对这个长输出感到困惑......
Installing collected packages: pyopencv
Running setup.py install for pyopencv
building 'pyopencv.pyopencv_extras' extension
cc -fno-strict-aliasing -fno-common -dynamic -I/usr/local/include -I/usr/local/opt/sqlite/include -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -dynamiclib -I/System/Library/Frameworks/Python.framework/Headers -I/usr/local/include -I/usr/local/include/opencv -I/usr/local/include -I/Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package -I/Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras -I/Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core -I/Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/sdopencv -I/usr/local/lib/python2.7/site-packages/numpy/core/include/numpy -I/usr/local/Cellar/python/2.7.4/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c package/extras/core/ndarray.cpp -o build/temp.macosx-10.8-x86_64-2.7/package/extras/core/ndarray.o -O3 -DNDEBUG
clang: warning: argument unused during compilation: '-dynamiclib'
In file included from package/extras/core/ndarray.cpp:16:
In file included from /usr/local/lib/python2.7/site-packages/numpy/core/include/numpy/arrayobject.h:15:
In file included from /usr/local/lib/python2.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:17:
In file included from /usr/local/lib/python2.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1728:
/usr/local/lib/python2.7/site-packages/numpy/core/include/numpy/npy_deprecated_api.h:11:2: warning: "Using deprecated NumPy API, disable it by #defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-W#warnings]
#warning "Using deprecated NumPy API, disable it by #defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION"
^
In file included from package/extras/core/ndarray.cpp:18:
In file included from /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core/ndarray.hpp:18:
In file included from /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core/opencv_headers.hpp:9:
/Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/sdopencv/sdcxmat.hpp:58:13: error: redefinition of 'Mat'
inline Mat::Mat()
^
/usr/local/include/opencv2/core/mat.hpp:67:13: note: previous definition is here
inline Mat::Mat() : size(&rows)
^
In file included from package/extras/core/ndarray.cpp:18:
In file included from /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core/ndarray.hpp:18:
In file included from /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core/opencv_headers.hpp:9:
/Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/sdopencv/sdcxmat.hpp:59:35: warning: field 'step' will be initialized after field 'data' [-Wreorder]
: flags(0), rows(0), cols(0), step(0), data(0), refcount(0), datastart(0), dataend(0) {}
^
/Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/sdopencv/sdcxmat.hpp:58:13: error: constructor for 'cv::Mat' must explicitly initialize the member 'size' which does not have a default constructor
inline Mat::Mat()
^
/usr/local/include/opencv2/core/core.hpp:1976:11: note: member is declared here
MSize size;
^
/usr/local/include/opencv2/core/core.hpp:1948:23: note: 'cv::Mat::MSize' declared here
struct CV_EXPORTS MSize
^
In file included from package/extras/core/ndarray.cpp:18:
In file included from /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core/ndarray.hpp:18:
In file included from /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core/opencv_headers.hpp:9:
/Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/sdopencv/sdcxmat.hpp:61:13: error: redefinition of 'Mat'
inline Mat::Mat(int _rows, int _cols, int _type)
^
/usr/local/include/opencv2/core/mat.hpp:72:13: note: previous definition is here
inline Mat::Mat(int _rows, int _cols, int _type) : size(&rows)
^
In file included from package/extras/core/ndarray.cpp:18:
In file included from /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core/ndarray.hpp:18:
In file included from /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core/opencv_headers.hpp:9:
/Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/sdopencv/sdcxmat.hpp:62:35: warning: field 'step' will be initialized after field 'data' [-Wreorder]
: flags(0), rows(0), cols(0), step(0), data(0), refcount(0), datastart(0), dataend(0)
^
/Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/sdopencv/sdcxmat.hpp:61:13: error: constructor for 'cv::Mat' must explicitly initialize the member 'size' which does not have a default constructor
inline Mat::Mat(int _rows, int _cols, int _type)
^
/usr/local/include/opencv2/core/core.hpp:1976:11: note: member is declared here
MSize size;
^
/usr/local/include/opencv2/core/core.hpp:1948:23: note: 'cv::Mat::MSize' declared here
struct CV_EXPORTS MSize
^
In file included from package/extras/core/ndarray.cpp:18:
In file included from /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core/ndarray.hpp:18:
In file included from /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core/opencv_headers.hpp:9:
/Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/sdopencv/sdcxmat.hpp:68:13: error: redefinition of 'Mat'
inline Mat::Mat(int _rows, int _cols, int _type, const Scalar& _s)
^
/usr/local/include/opencv2/core/mat.hpp:78:13: note: previous definition is here
inline Mat::Mat(int _rows, int _cols, int _type, const Scalar& _s) : size(&rows)
^
In file included from package/extras/core/ndarray.cpp:18:
In file included from /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core/ndarray.hpp:18:
In file included from /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core/opencv_headers.hpp:9:
/Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/sdopencv/sdcxmat.hpp:69:35: warning: field 'step' will be initialized after field 'data' [-Wreorder]
: flags(0), rows(0), cols(0), step(0), data(0), refcount(0),
^
/Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/sdopencv/sdcxmat.hpp:68:13: error: constructor for 'cv::Mat' must explicitly initialize the member 'size' which does not have a default constructor
inline Mat::Mat(int _rows, int _cols, int _type, const Scalar& _s)
^
/usr/local/include/opencv2/core/core.hpp:1976:11: note: member is declared here
MSize size;
^
/usr/local/include/opencv2/core/core.hpp:1948:23: note: 'cv::Mat::MSize' declared here
struct CV_EXPORTS MSize
^
In file included from package/extras/core/ndarray.cpp:18:
In file included from /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core/ndarray.hpp:18:
In file included from /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core/opencv_headers.hpp:9:
/Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/sdopencv/sdcxmat.hpp:79:13: error: redefinition of 'Mat'
inline Mat::Mat(Size _size, int _type)
^
/usr/local/include/opencv2/core/mat.hpp:85:13: note: previous definition is here
inline Mat::Mat(Size _sz, int _type) : size(&rows)
^
In file included from package/extras/core/ndarray.cpp:18:
In file included from /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core/ndarray.hpp:18:
In file included from /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core/opencv_headers.hpp:9:
/Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/sdopencv/sdcxmat.hpp:80:35: warning: field 'step' will be initialized after field 'data' [-Wreorder]
: flags(0), rows(0), cols(0), step(0), data(0), refcount(0),
^
/Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/sdopencv/sdcxmat.hpp:79:13: error: constructor for 'cv::Mat' must explicitly initialize the member 'size' which does not have a default constructor
inline Mat::Mat(Size _size, int _type)
^
/usr/local/include/opencv2/core/core.hpp:1976:11: note: member is declared here
MSize size;
^
/usr/local/include/opencv2/core/core.hpp:1948:23: note: 'cv::Mat::MSize' declared here
struct CV_EXPORTS MSize
^
In file included from package/extras/core/ndarray.cpp:18:
In file included from /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core/ndarray.hpp:18:
In file included from /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core/opencv_headers.hpp:9:
/Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/sdopencv/sdcxmat.hpp:87:13: error: redefinition of 'Mat'
inline Mat::Mat(Size _size, int _type, const Scalar& _s)
^
/usr/local/include/opencv2/core/mat.hpp:91:13: note: previous definition is here
inline Mat::Mat(Size _sz, int _type, const Scalar& _s) : size(&rows)
^
In file included from package/extras/core/ndarray.cpp:18:
In file included from /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core/ndarray.hpp:18:
In file included from /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core/opencv_headers.hpp:9:
/Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/sdopencv/sdcxmat.hpp:88:31: warning: field 'step' will be initialized after field 'data' [-Wreorder]
: flags(0), rows(0), cols(0), step(0), data(0), refcount(0),
^
/Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/sdopencv/sdcxmat.hpp:87:13: error: constructor for 'cv::Mat' must explicitly initialize the member 'size' which does not have a default constructor
inline Mat::Mat(Size _size, int _type, const Scalar& _s)
^
/usr/local/include/opencv2/core/core.hpp:1976:11: note: member is declared here
MSize size;
^
/usr/local/include/opencv2/core/core.hpp:1948:23: note: 'cv::Mat::MSize' declared here
struct CV_EXPORTS MSize
^
In file included from package/extras/core/ndarray.cpp:18:
In file included from /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core/ndarray.hpp:18:
In file included from /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core/opencv_headers.hpp:9:
/Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/sdopencv/sdcxmat.hpp:98:13: error: redefinition of 'Mat'
inline Mat::Mat(const Mat& m)
^
/usr/local/include/opencv2/core/mat.hpp:111:13: note: previous definition is here
inline Mat::Mat(const Mat& m)
^
In file included from package/extras/core/ndarray.cpp:18:
In file included from /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core/ndarray.hpp:18:
In file included from /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core/opencv_headers.hpp:9:
/Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/sdopencv/sdcxmat.hpp:99:51: warning: field 'step' will be initialized after field 'data' [-Wreorder]
: flags(m.flags), rows(m.rows), cols(m.cols), step(m.step), data(m.data),
^
/Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/sdopencv/sdcxmat.hpp:98:13: error: constructor for 'cv::Mat' must explicitly initialize the member 'size' which does not have a default constructor
inline Mat::Mat(const Mat& m)
^
/usr/local/include/opencv2/core/core.hpp:1976:11: note: member is declared here
MSize size;
^
/usr/local/include/opencv2/core/core.hpp:1948:23: note: 'cv::Mat::MSize' declared here
struct CV_EXPORTS MSize
^
In file included from package/extras/core/ndarray.cpp:18:
In file included from /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core/ndarray.hpp:18:
In file included from /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core/opencv_headers.hpp:9:
/Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/sdopencv/sdcxmat.hpp:106:13: error: redefinition of 'Mat'
inline Mat::Mat(int _rows, int _cols, int _type, void* _data, size_t _step)
^
/usr/local/include/opencv2/core/mat.hpp:129:13: note: previous definition is here
inline Mat::Mat(int _rows, int _cols, int _type, void* _data, size_t _step)
^
In file included from package/extras/core/ndarray.cpp:18:
In file included from /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core/ndarray.hpp:18:
In file included from /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core/opencv_headers.hpp:9:
/Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/sdopencv/sdcxmat.hpp:108:5: warning: field 'step' will be initialized after field 'data' [-Wreorder]
step(_step), data((uchar*)_data), refcount(0),
^
/Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/sdopencv/sdcxmat.hpp:106:13: error: constructor for 'cv::Mat' must explicitly initialize the member 'size' which does not have a default constructor
inline Mat::Mat(int _rows, int _cols, int _type, void* _data, size_t _step)
^
/usr/local/include/opencv2/core/core.hpp:1976:11: note: member is declared here
MSize size;
^
/usr/local/include/opencv2/core/core.hpp:1948:23: note: 'cv::Mat::MSize' declared here
struct CV_EXPORTS MSize
^
In file included from package/extras/core/ndarray.cpp:18:
In file included from /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core/ndarray.hpp:18:
In file included from /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core/opencv_headers.hpp:9:
/Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/sdopencv/sdcxmat.hpp:126:13: error: redefinition of 'Mat'
inline Mat::Mat(Size _size, int _type, void* _data, size_t _step)
^
/usr/local/include/opencv2/core/mat.hpp:151:13: note: previous definition is here
inline Mat::Mat(Size _sz, int _type, void* _data, size_t _step)
^
In file included from package/extras/core/ndarray.cpp:18:
In file included from /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core/ndarray.hpp:18:
In file included from /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core/opencv_headers.hpp:9:
/Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/sdopencv/sdcxmat.hpp:128:5: warning: field 'step' will be initialized after field 'data' [-Wreorder]
step(_step), data((uchar*)_data), refcount(0),
^
/Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/sdopencv/sdcxmat.hpp:126:13: error: constructor for 'cv::Mat' must explicitly initialize the member 'size' which does not have a default constructor
inline Mat::Mat(Size _size, int _type, void* _data, size_t _step)
^
/usr/local/include/opencv2/core/core.hpp:1976:11: note: member is declared here
MSize size;
^
/usr/local/include/opencv2/core/core.hpp:1948:23: note: 'cv::Mat::MSize' declared here
struct CV_EXPORTS MSize
^
In file included from package/extras/core/ndarray.cpp:18:
In file included from /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core/ndarray.hpp:18:
In file included from /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core/opencv_headers.hpp:9:
/Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/sdopencv/sdcxmat.hpp:146:13: error: constructor for 'cv::Mat' must explicitly initialize the member 'size' which does not have a default constructor
inline Mat::Mat(const Mat& m, const Range& rowRange, const Range& colRange)
^
/usr/local/include/opencv2/core/core.hpp:1976:11: note: member is declared here
MSize size;
^
/usr/local/include/opencv2/core/core.hpp:1948:23: note: 'cv::Mat::MSize' declared here
struct CV_EXPORTS MSize
^
In file included from package/extras/core/ndarray.cpp:18:
In file included from /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core/ndarray.hpp:18:
In file included from /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core/opencv_headers.hpp:9:
/Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/sdopencv/sdcxmat.hpp:149:10: error: 'operator=' is a protected member of 'cv::Mat::MStep'
step = m.step; refcount = m.refcount;
~~~~ ^ ~~~~~~
/usr/local/include/opencv2/core/core.hpp:1973:16: note: declared protected here
MStep& operator = (const MStep&);
^
In file included from package/extras/core/ndarray.cpp:18:
In file included from /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core/ndarray.hpp:18:
In file included from /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core/opencv_headers.hpp:9:
/Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/sdopencv/sdcxmat.hpp:182:5: warning: field 'step' will be initialized after field 'data' [-Wreorder]
step(m.step), data(m.data + roi.y*step), refcount(m.refcount),
^
/Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/sdopencv/sdcxmat.hpp:180:13: error: constructor for 'cv::Mat' must explicitly initialize the member 'size' which does not have a default constructor
inline Mat::Mat(const Mat& m, const Rect& roi)
^
/usr/local/include/opencv2/core/core.hpp:1976:11: note: member is declared here
MSize size;
^
/usr/local/include/opencv2/core/core.hpp:1948:23: note: 'cv::Mat::MSize' declared here
struct CV_EXPORTS MSize
^
In file included from package/extras/core/ndarray.cpp:18:
In file included from /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core/ndarray.hpp:18:
In file included from /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core/opencv_headers.hpp:9:
/Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/sdopencv/sdcxmat.hpp:197:35: warning: field 'step' will be initialized after field 'data' [-Wreorder]
rows(m->rows), cols(m->cols), step(m->step), data(m->data.ptr), refcount(0),
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
11 warnings and 20 errors generated.
error: command 'cc' failed with exit status 1
Complete output from command /Users/andrewcopp/Developer/backend/vendor/venv/bin/python -c "import setuptools;__file__='/Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/00/v2cptx497wb4bwpl5fc3w8yc0000gn/T/pip-pW3TZf-record/install-record.txt --single-version-externally-managed --install-headers /Users/andrewcopp/Developer/backend/vendor/venv/bin/../include/site/python2.7:
...
然后输出更详细,但StackOverflow限制了帖子的大小。
对于它的价值,我在这个virtualenv中安装了许多其他包,包括枕头和numpy。
答案 0 :(得分:2)
如果安装了OpenCV,则无需安装pyopencv。结果似乎不再支持pyopencv。