python setup.py install 出错
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python setup.py install 出错相关的知识,希望对你有一定的参考价值。
安装Pymysql-0.7.11出错
不知道什么问题
非管理员命令行使用 python setup.py --user install本回答被提问者和网友采纳 参考技术B 用管理员模式打开cmd终端,然后按照你原来操作再做一遍
使用 python setup.py install 时出现“错误:‘remap’不是‘cv’的成员”
【中文标题】使用 python setup.py install 时出现“错误:‘remap’不是‘cv’的成员”【英文标题】:" error: ‘remap’ is not a member of ‘cv’ " when using python setup.py install 【发布时间】:2015-06-23 15:33:55 【问题描述】:我正在尝试通过终端在 Ubuntu 上为 Python 安装面部跟踪器。我从这里安装:
https://pypi.python.org/pypi/pyFaceTracker/0.1.1
并从这里使用了 linux 版本的 setup.py: http://reidmayo.com/2014/07/15/how-to-install-pyfacetracker-on-linux-fedora-19/
但是当我尝试在包目录中输入“sudo python setup.py install”时,它最终给了我这个错误:
running install
running bdist_egg
running egg_info
writing pyFaceTracker.egg-info/PKG-INFO
writing top-level names to pyFaceTracker.egg-info/top_level.txt
writing dependency_links to pyFaceTracker.egg-info/dependency_links.txt
reading manifest file 'pyFaceTracker.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'pyFaceTracker.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
running build_ext
building 'facetracker._facetracker' extension
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Iexternal/FaceTracker/include -I/usr/include/opencv2/core -I/usr/include/opencv2/imgproc -I/usr/include/opencv2/video -I/usr/include/opencv2/features2d -I/usr/include/opencv2/flann -I/usr/include/opencv2/calib3d -I/usr/include/opencv2/objdetect -I/usr/include/opencv2/legacy -I/usr/lib/python2.7/dist-packages/numpy/core/include -I/usr/include/python2.7 -c external/FaceTracker/src/lib/PDM.cc -o build/temp.linux-x86_64-2.7/external/FaceTracker/src/lib/PDM.o
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
external/FaceTracker/src/lib/PDM.cc: In member function ‘void FACETRACKER::PDM::CalcRigidJacob(cv::Mat&, cv::Mat&, cv::Mat&)’:
external/FaceTracker/src/lib/PDM.cc:234:23: warning: unused variable ‘m’ [-Wunused-variable]
int i,n = _M.rows/3,m = _V.cols; double X,Y,Z;
^
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Iexternal/FaceTracker/include -I/usr/include/opencv2/core -I/usr/include/opencv2/imgproc -I/usr/include/opencv2/video -I/usr/include/opencv2/features2d -I/usr/include/opencv2/flann -I/usr/include/opencv2/calib3d -I/usr/include/opencv2/objdetect -I/usr/include/opencv2/legacy -I/usr/lib/python2.7/dist-packages/numpy/core/include -I/usr/include/python2.7 -c external/FaceTracker/src/lib/PAW.cc -o build/temp.linux-x86_64-2.7/external/FaceTracker/src/lib/PAW.o
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
external/FaceTracker/src/lib/PAW.cc: In member function ‘void FACETRACKER::PAW::Crop(cv::Mat&, cv::Mat&, cv::Mat&)’:
external/FaceTracker/src/lib/PAW.cc:167:3: error: ‘remap’ is not a member of ‘cv’
cv::remap(src,dst,_mapx,_mapy,CV_INTER_LINEAR); return;
^
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
如果有帮助,我将使用 C++ 的 OpenCV 3.0.0 alpha 和 python 的 OpenCV 3.0.0 beta。
我该如何解决这样的问题?
【问题讨论】:
尝试使其成为#include <opencv2/opencv.hpp>
here ,旧的 c-api 标头(opencv/cv.h)不再拉入正确的 opencv2/calib3d.hpp
标头
我尝试在“_pyFaceTracker.cpp”中用“要让它找到 cv::remap,正如@berak 所说,你必须让它包含 opencv2/opencv.hpp,但不在 _pyFaceTracker.cpp 中,你必须将它包含在 here (IO.h )。 IO.h 用于 PAW.h 并实现 cv::remap 功能。完成此操作后,我摆脱了该错误并偶然发现了另一个有关辅助函数的错误。这里有什么想法吗?
警告:请提前登录! `
In file included from src/_pyFaceTracker.cpp:20:0:
src/opencv_helpers.h:161:16: error: cannot declare variable ‘g_numpyAllocator’ to be of abstract type ‘NumpyAllocator’
NumpyAllocator g_numpyAllocator;
^
src/opencv_helpers.h:111:7: note: because the following virtual functions are pure within ‘NumpyAllocator’:
class NumpyAllocator : public MatAllocator
^
In file included from /usr/local/include/opencv2/core.hpp:59:0,
from /usr/local/include/opencv2/opencv.hpp:46,
from external/FaceTracker/include/FaceTracker/IO.h:43,
from external/FaceTracker/include/FaceTracker/PDM.h:42,
from external/FaceTracker/include/FaceTracker/CLM.h:42,
from external/FaceTracker/include/FaceTracker/Tracker.h:42,
from src/_pyFaceTracker.cpp:12:
/usr/local/include/opencv2/core/mat.hpp:417:23: note: virtual cv::UMatData* cv::MatAllocator::allocate(int, const int*, int, void*, size_t*, int, cv::UMatUsageFlags) const
virtual UMatData* allocate(int dims, const int* sizes, int type,
^
/usr/local/include/opencv2/core/mat.hpp:419:18: note: virtual bool cv::MatAllocator::allocate(cv::UMatData*, int, cv::UMatUsageFlags) const
virtual bool allocate(UMatData* data, int accessflags, UMatUsageFlags usage
^
/usr/local/include/opencv2/core/mat.hpp:420:18: note: virtual void cv::MatAllocator::deallocate(cv::UMatData*) const
virtual void deallocate(UMatData* data) const = 0;
^
In file included from src/_pyFaceTracker.cpp:20:0:
src/opencv_helpers.h: In function ‘int pyopencv_to(const PyObject*, cv::Mat&, const char*, bool)’:
src/opencv_helpers.h:241:11: error: ‘class cv::Mat’ has no member named ‘refcount’
m.refcount = refcountFromPyObject(o);
^
src/opencv_helpers.h: In function ‘PyObject* pyopencv_from(const cv::Mat&)’:
src/opencv_helpers.h:262:12: error: ‘class cv::Mat’ has no member named ‘refcount’
if(!p->refcount || p->allocator != &g_numpyAllocator)
^
src/opencv_helpers.h:269:36: error: ‘class cv::Mat’ has no member named ‘refcount’
return pyObjectFromRefcount(p->refcount);
^
src/opencv_helpers.h: At global scope:
src/opencv_helpers.h:349:35: error: ‘vector’ has not been declared
static bool to(PyObject* obj, vector<_Tp>& value, const char* name="<unknow
^
src/opencv_helpers.h:349:41: error: expected ‘,’ or ‘...’ before ‘<’ token
static bool to(PyObject* obj, vector<_Tp>& value, const char* name="<unknow
^
src/opencv_helpers.h:440:33: error: ‘vector’ does not name a type
static PyObject* from(const vector<_Tp>& value)
^
src/opencv_helpers.h:440:39: error: expected ‘,’ or ‘...’ before ‘<’ token
static PyObject* from(const vector<_Tp>& value)
^
src/opencv_helpers.h: In static member function ‘static bool pyopencvVecConverter<_Tp>::to(PyObject*, int)’:
src/opencv_helpers.h:357:33: error: ‘name’ was not declared in this scope
pyopencv_to(obj, m, name);
^
src/opencv_helpers.h:358:22: error: ‘value’ was not declared in this scope
m.copyTo(value);
^
src/opencv_helpers.h:362:46: error: ‘name’ was not declared in this scope
PyObject *seq = PySequence_Fast(obj, name);
^
src/opencv_helpers.h:366:9: error: ‘value’ was not declared in this scope
value.resize(n);
^
src/opencv_helpers.h: In static member function ‘static PyObject* pyopencvVecConverter<_Tp>::from(int)’:
src/opencv_helpers.h:442:12: error: ‘value’ was not declared in this scope
if(value.empty())
^
src/opencv_helpers.h:444:22: error: ‘value’ was not declared in this scope
Mat src((int)value.size(), DataType<_Tp>::channels, DataType<_Tp>::dept
^
src/opencv_helpers.h: At global scope:
src/opencv_helpers.h:450:70: error: ‘vector’ has not been declared
emplate<typename _Tp> static inline bool pyopencv_to(PyObject* obj, vector<_Tp>
^
src/opencv_helpers.h:450:76: error: expected ‘,’ or ‘...’ before ‘<’ token
e<typename _Tp> static inline bool pyopencv_to(PyObject* obj, vector<_Tp>& valu
^
src/opencv_helpers.h: In function ‘bool pyopencv_to(PyObject*, int)’:
src/opencv_helpers.h:452:47: error: ‘value’ was not declared in this scope
return pyopencvVecConverter<_Tp>::to(obj, value, name);
^
src/opencv_helpers.h:452:54: error: ‘name’ was not declared in this scope
return pyopencvVecConverter<_Tp>::to(obj, value, name);
^
src/opencv_helpers.h: At global scope:
src/opencv_helpers.h:455:68: error: ‘vector’ does not name a type
template<typename _Tp> static inline PyObject* pyopencv_from(const vector<_Tp>&
^
src/opencv_helpers.h:455:74: error: expected ‘,’ or ‘...’ before ‘<’ token
ate<typename _Tp> static inline PyObject* pyopencv_from(const vector<_Tp>& valu
^
src/opencv_helpers.h: In function ‘PyObject* pyopencv_from(int)’:
src/opencv_helpers.h:457:44: error: ‘value’ was not declared in this scope
return pyopencvVecConverter<_Tp>::from(value);
^
src/_pyFaceTracker.cpp: In function ‘int FaceTracker_init(FaceTracker*, PyObject*, PyObject*)’:
src/_pyFaceTracker.cpp:91:43: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
static char *kwlist[] = "fname", NULL;
^
src/_pyFaceTracker.cpp: At global scope:
src/_pyFaceTracker.cpp:129:1: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
;
^
src/_pyFaceTracker.cpp:129:1: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
src/_pyFaceTracker.cpp:129:1: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
src/_pyFaceTracker.cpp:129:1: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
src/_pyFaceTracker.cpp:129:1: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
src/_pyFaceTracker.cpp:129:1: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
src/_pyFaceTracker.cpp:129:1: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
src/_pyFaceTracker.cpp:129:1: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
src/_pyFaceTracker.cpp:129:1: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
src/_pyFaceTracker.cpp:129:1: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
src/_pyFaceTracker.cpp:129:1: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
src/_pyFaceTracker.cpp:129:1: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
src/_pyFaceTracker.cpp: In function ‘PyObject* FaceTracker_setWindowSizes(FaceTracker*, PyObject*)’:
src/_pyFaceTracker.cpp:157:58: error: no matching function for call to ‘pyopencv_to(PyObject*&, std::vector<int>&)’
if (!pyopencv_to<int>(sizes_array, self->window_sizes))
^
In file included from src/_pyFaceTracker.cpp:20:0:
src/opencv_helpers.h:450:43: note: candidate: template<class _Tp> bool pyopencv_to(PyObject*, int)
template<typename _Tp> static inline bool pyopencv_to(PyObject* obj, vector<_Tp
^
src/opencv_helpers.h:450:43: note: template argument deduction/substitution failed:
src/_pyFaceTracker.cpp:157:46: note: cannot convert ‘self->FaceTracker::window_sizes’ (type ‘std::vector<int>’) to type ‘int’
if (!pyopencv_to<int>(sizes_array, self->window_sizes))
^
In file included from src/_pyFaceTracker.cpp:20:0:
src/opencv_helpers.h: At global scope:
src/opencv_helpers.h:59:18: warning: ‘opencv_error’ defined but not used [-Wunused-variable]
static PyObject* opencv_error = 0;
^
src/opencv_helpers.h:272:13: warning: ‘bool pyopencv_to(PyObject*, cv::Scalar&, const char*)’ defined but not used [-Wunused-function]
static bool pyopencv_to(PyObject *o, Scalar& s, const char *name = "<unknown>")
^
src/opencv_helpers.h:311:18: warning: ‘PyObject* pyopencv_from(bool)’ defined but not used [-Wunused-function]
static PyObject* pyopencv_from(bool value)
^
src/opencv_helpers.h:316:13: warning: ‘bool pyopencv_to(PyObject*, bool&, const char*)’ defined but not used [-Wunused-function]
static bool pyopencv_to(PyObject* obj, bool& value, const char* name = "<unknow
^
src/opencv_helpers.h:328:18: warning: ‘PyObject* pyopencv_from(size_t)’ defined but not used [-Wunused-function]
static PyObject* pyopencv_from(size_t value)
^
src/opencv_helpers.h:333:13: warning: ‘bool pyopencv_to(PyObject*, size_t&, const char*)’ defined but not used [-Wunused-function]
static bool pyopencv_to(PyObject* obj, size_t& value, const char* name = "<unkn
^
src/opencv_helpers.h:342:18: warning: ‘PyObject* pyopencv_from(int)’ defined but not used [-Wunused-function]
static PyObject* pyopencv_from(int value)
^
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
`
【讨论】:
以上是关于python setup.py install 出错的主要内容,如果未能解决你的问题,请参考以下文章
ImportError: No module... 在 python setup.py install 之后
Python setup.py install 指定 extras_require