Когда я впервые попытался установить pyopencv

./vendor/venv/bin/pip install pyopencv

Он сказал, что возникла проблема с использованием CMake.

Я построил 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.

1
andrewcopp 28 Май 2013 в 19:47
Какие версии вы используете: OpenCV, pyopencv, Python? Проверьте это (возможный дубликат): stackoverflow.com/q/12354628. И также проверьте это: rqna.net/qna/…
 – 
Velimir Mlaker
28 Май 2013 в 20:11
Я не вижу в вашем журнале ошибки CMake. Насколько мне известно, вы не можете заставить устанавливаемую библиотеку Python pip использовать CMake ... Вы уверены, что CMake - ваша проблема?
 – 
SethMMorton
29 Май 2013 в 08:59
@VelimirMlaker: я использую OpenCV v.2.4.3, Python 2.7.5, и похоже, что я пытаюсь установить pyopencv v2.1.0.wr1.2.0
 – 
andrewcopp
29 Май 2013 в 16:51
Честно говоря, я не совсем уверен, в чем мои проблемы. Я использовал pip для установки всех своих пакетов в virtualenv. Есть ли способ лучше?
 – 
andrewcopp
29 Май 2013 в 16:51
2
Но зачем вам использовать pyopencv из pip, если OpenCV по умолчанию поставляется со своими собственными привязками python?
 – 
Abid Rahman K
30 Май 2013 в 09:00

1 ответ

Лучший ответ

Вам не нужно устанавливать pyopencv, если у вас установлен OpenCV. Похоже, что в результате pyopencv больше не поддерживается.

2
andrewcopp 4 Дек 2013 в 22:42
Похоже, это означает, что import cv2.cv и import cv оба терпят неудачу .... (так что библиотека, которую я пытаюсь использовать, тоже терпит неудачу)
 – 
Andy Hayden
13 Авг 2015 в 06:01