Tôi đang cố gắng cài đặt OpenCV trong một virtualenv trên Máy chủ Ubuntu 12.04 của tôi. Tôi đã tìm thấy a thread discussing this nhưng đã quản lý để trích xuất không có thông tin từ nó.Chạy OpenCV từ một virtualenv Python
Tôi đã thử sử dụng pip install pyopencv
nhưng không thành công.
...
package/extras/core/ndarray.cpp:598:1: instantiated from here
package/extras/core/ndarray.cpp:546:9: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘Py_intptr_t {aka long int}’ [-Wformat]
package/extras/core/ndarray.cpp: In function ‘boost::python::api::object sdcpp::from_ndarray_impl(const sdcpp::ndarray&) [with T = cv::Scalar_<double>]’:
package/extras/core/ndarray.cpp:601:1: instantiated from here
package/extras/core/ndarray.cpp:546:9: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘Py_intptr_t {aka long int}’ [-Wformat]
package/extras/core/ndarray.cpp: In function ‘boost::python::api::object sdcpp::from_ndarray_impl(const sdcpp::ndarray&) [with T = cv::Range]’:
package/extras/core/ndarray.cpp:604:1: instantiated from here
package/extras/core/ndarray.cpp:546:9: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘Py_intptr_t {aka long int}’ [-Wformat]
error: command 'gcc' failed with exit status 1
Lỗi này chỉ xảy ra lần thứ hai tôi chạy pip install
. Nếu tôi xóa thư mục remainging build/
tôi nhận được lỗi này.
-- Configuring incomplete, errors occurred!
Configuring PyOpenCV via CMake...
Error: error occurred while running CMake to configure PyOpenCV.
You may want to manually configure PyOpenCV by running cmake's tools:
mkdir build
cd build
cmake-gui .. OR cmake ..
cd ..
----------------------------------------
Command python setup.py egg_info failed with error code 255
Tôi đã cài đặt ít nhất các gói apt sau.
build-essential
uuid-dev
python-dev
python-pip
libpq-dev
cmake
libboost-dev
libcv-dev
libcvaux-dev
libboost-python-dev
libboost1.48-dev
Làm cách nào để cài đặt OpenCV trong virtualenv của tôi?
Tôi đang gặp vấn đề tương tự. Tuy nhiên, tôi nhận thấy rằng 'pyopencv' tương ứng với dự án này http://code.google.com/p/pyopencv/ và không phải là các ràng buộc python đi kèm với opencv 2.X –