“UnicodeDecodeError:'ascii'编解码器不能解码位置75中的字节0xe2:序号不在范围内(128)”使用pip for python flandmark

时间:2015-06-22 18:07:24

标签: python-2.7 unicode terminal pip ubuntu-14.04

我试图使用pip为Python安装flandmark,但我最终得到一个错误,我无法弄清楚如何解决或错误意味着什么。

在Ubuntu终端中,我使用了这个命令:

sudo pip install bob.ip.flandmark

当我尝试使用该命令时,它给了我这个错误:

Traceback (most recent call last):
  File "/usr/local/bin/pip", line 9, in <module>
    load_entry_point('pip==1.5.4', 'console_scripts', 'pip')()
  File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 235, in main
    return command.main(cmd_args)
  File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 161, in main
    text = '\n'.join(complete_log)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 75: ordinal not in range(128)

这是Ubuntu命令行的另一个输出(有些被截断,因为它不会让我更进一步):

                 from bob/ip/flandmark/flandmark_detector.h:15,

                 from bob/ip/flandmark/flandmark_detector.cpp:17:

/usr/include/c++/4.8/bits/stringfwd.h:62:33: note:   ‘std::string’

   typedef basic_string<char>    string;

                                 ^

In file included from /usr/local/include/opencv/cvaux.h:56:0,

                 from bob/ip/flandmark/flandmark_detector.h:16,

                 from bob/ip/flandmark/flandmark_detector.cpp:17:

/usr/local/include/opencv2/legacy.hpp:2673:58: error: call to ‘cv::OneWayDescriptorMatcher::Params::Params(int, cv::Size, int, int, int, float, float, float)’ uses the default argument for parameter 3, which is not yet defined

     OneWayDescriptorMatcher( const Params& params=Params() );

                                                          ^

/usr/local/include/opencv2/legacy.hpp:2673:58: error: call to ‘cv::OneWayDescriptorMatcher::Params::Params(int, cv::Size, int, int, int, float, float, float)’ uses the default argument for parameter 4, which is not yet defined

/usr/local/include/opencv2/legacy.hpp:2673:58: error: call to ‘cv::OneWayDescriptorMatcher::Params::Params(int, cv::Size, int, int, int, float, float, float)’ uses the default argument for parameter 5, which is not yet defined

/usr/local/include/opencv2/legacy.hpp:2718:1: error: expected class-name before ‘{’ token

 {

 ^

/usr/local/include/opencv2/legacy.hpp:2732:23: error: ‘string’ does not name a type

         Params( const string& filename );

                       ^

/usr/local/include/opencv2/legacy.hpp:2743:9: error: ‘string’ does not name a type

         string filename;

         ^

/usr/local/include/opencv2/legacy.hpp:2759:17: error: ‘GenericDescriptorMatcher’ was not declared in this scope

     virtual Ptr<GenericDescriptorMatcher> clone( bool emptyTrainData=false ) const;

                 ^

/usr/local/include/opencv2/legacy.hpp:2759:41: error: template argument 1 is invalid

     virtual Ptr<GenericDescriptorMatcher> clone( bool emptyTrainData=false ) const;

                                         ^

/usr/local/include/opencv2/legacy.hpp:2762:55: error: ‘vector’ has not been declared

     virtual void knnMatchImpl( const Mat& queryImage, vector<KeyPoint>& queryKeypoints,

                                                       ^

/usr/local/include/opencv2/legacy.hpp:2762:61: error: expected ‘,’ or ‘...’ before ‘<’ token

     virtual void knnMatchImpl( const Mat& queryImage, vector<KeyPoint>& queryKeypoints,

                                                             ^

/usr/local/include/opencv2/legacy.hpp:2765:58: error: ‘vector’ has not been declared

     virtual void radiusMatchImpl( const Mat& queryImage, vector<KeyPoint>& queryKeypoints,

                                                          ^

/usr/local/include/opencv2/legacy.hpp:2765:64: error: expected ‘,’ or ‘...’ before ‘<’ token

     virtual void radiusMatchImpl( const Mat& queryImage, vector<KeyPoint>& queryKeypoints,

                                                                ^

/usr/local/include/opencv2/legacy.hpp:2771:70: error: ‘vector’ has not been declared

                                  float& bestProb, int& bestMatchIdx, vector<float>& signature );

                                                                      ^

/usr/local/include/opencv2/legacy.hpp:2771:76: error: expected ‘,’ or ‘...’ before ‘<’ token

                                  float& bestProb, int& bestMatchIdx, vector<float>& signature );

                                                                            ^

/usr/local/include/opencv2/legacy.hpp:2785:40: error: ‘string’ does not name a type

     CalonderDescriptorExtractor( const string& classifierFile );

                                        ^

/usr/local/include/opencv2/legacy.hpp:2796:49: error: ‘vector’ has not been declared

     virtual void computeImpl( const Mat& image, vector<KeyPoint>& keypoints, Mat& descriptors ) const;

                                                 ^

/usr/local/include/opencv2/legacy.hpp:2796:55: error: expected ‘,’ or ‘...’ before ‘<’ token

     virtual void computeImpl( const Mat& image, vector<KeyPoint>& keypoints, Mat& descriptors ) const;

                                                       ^

/usr/local/include/opencv2/legacy.hpp:2803:1: error: prototype for ‘cv::CalonderDescriptorExtractor<T>::CalonderDescriptorExtractor(const string&)’ does not match any in class ‘cv::CalonderDescriptorExtractor<T>’

 CalonderDescriptorExtractor<T>::CalonderDescriptorExtractor(const std::string& classifier_file)

 ^

/usr/local/include/opencv2/legacy.hpp:2785:5: error: candidate is: cv::CalonderDescriptorExtractor<T>::CalonderDescriptorExtractor(const int&)

     CalonderDescriptorExtractor( const string& classifierFile );

     ^

/usr/local/include/opencv2/legacy.hpp:2810:50: error: ‘vector’ has not been declared

                                                  vector<KeyPoint>& keypoints,

                                                  ^

/usr/local/include/opencv2/legacy.hpp:2810:56: error: expected ‘,’ or ‘...’ before ‘<’ token

                                                  vector<KeyPoint>& keypoints,

                                                        ^

/usr/local/include/opencv2/legacy.hpp: In member function ‘virtual void cv::CalonderDescriptorExtractor<T>::computeImpl(const cv::Mat&, int) const’:

/usr/local/include/opencv2/legacy.hpp:2814:39: error: ‘keypoints’ was not declared in this scope

     KeyPointsFilter::runByImageBorder(keypoints, image.size(), BORDER_SIZE);

                                       ^

/usr/local/include/opencv2/legacy.hpp:2817:5: error: ‘descriptors’ was not declared in this scope

     descriptors.create((int)keypoints.size(), classifier_.classes(), cv::DataType<T>::type);

     ^

/usr/local/include/opencv2/legacy.hpp:2825:58: error: expected primary-expression before ‘>’ token

         classifier_.getSignature( &ipl, descriptors.ptr<T>((int)i));

                                                          ^

/usr/local/include/opencv2/legacy.hpp: In member function ‘virtual bool cv::CalonderDescriptorExtractor<T>::empty() const’:

/usr/local/include/opencv2/legacy.hpp:2840:24: error: ‘const class cv::RTreeClassifier’ has no member named ‘trees_’

     return classifier_.trees_.empty();

                        ^

/usr/local/include/opencv2/legacy.hpp: At global scope:

/usr/local/include/opencv2/legacy.hpp:2864:32: error: ‘vector’ does not name a type

     PlanarObjectDetector(const vector<Mat>& pyr, int _npoints=300,

                                ^

/usr/local/include/opencv2/legacy.hpp:2864:38: error: expected ‘,’ or ‘...’ before ‘<’ token

     PlanarObjectDetector(const vector<Mat>& pyr, int _npoints=300,

                                      ^

/usr/local/include/opencv2/legacy.hpp:2872:30: error: ‘vector’ does not name a type

     virtual void train(const vector<Mat>& pyr, int _npoints=300,

                              ^

/usr/local/include/opencv2/legacy.hpp:2872:36: error: expected ‘,’ or ‘...’ before ‘<’ token

     virtual void train(const vector<Mat>& pyr, int _npoints=300,

                                    ^

/usr/local/include/opencv2/legacy.hpp:2879:30: error: ‘vector’ does not name a type

     virtual void train(const vector<Mat>& pyr, const vector<KeyPoint>& keypoints,

                              ^

/usr/local/include/opencv2/legacy.hpp:2879:36: error: expected ‘,’ or ‘...’ before ‘<’ token

     virtual void train(const vector<Mat>& pyr, const vector<KeyPoint>& keypoints,

                                    ^

/usr/local/include/opencv2/legacy.hpp:2879:18: error: ‘virtual void cv::PlanarObjectDetector::train(int)’ cannot be overloaded

     virtual void train(const vector<Mat>& pyr, const vector<KeyPoint>& keypoints,

                  ^

/usr/local/include/opencv2/legacy.hpp:2872:18: error: with ‘virtual void cv::PlanarObjectDetector::train(int)’

     virtual void train(const vector<Mat>& pyr, int _npoints=300,

                  ^

/usr/local/include/opencv2/legacy.hpp:2887:5: error: ‘vector’ does not name a type

     vector<KeyPoint> getModelPoints() const;

     ^

/usr/local/include/opencv2/legacy.hpp:2894:61: error: ‘vector’ has not been declared

     bool operator()(const Mat& image, CV_OUT Mat& H, CV_OUT vector<Point2f>& corners) const;

                                                             ^

/usr/local/include/opencv2/legacy.hpp:2894:67: error: expected ‘,’ or ‘...’ before ‘<’ token

     bool operator()(const Mat& image, CV_OUT Mat& H, CV_OUT vector<Point2f>& corners) const;

                                                                   ^

/usr/local/include/opencv2/legacy.hpp:2895:27: error: ‘vector’ does not name a type

     bool operator()(const vector<Mat>& pyr, const vector<KeyPoint>& keypoints,

                           ^

/usr/local/include/opencv2/legacy.hpp:2895:33: error: expected ‘,’ or ‘...’ before ‘<’ token

     bool operator()(const vector<Mat>& pyr, const vector<KeyPoint>& keypoints,

                                 ^

/usr/local/include/opencv2/legacy.hpp:2902:5: error: ‘vector’ does not name a type

     vector<KeyPoint> modelPoints;

     ^

/usr/local/include/opencv2/legacy.hpp:2950:38: error: variable or field ‘cvInitSubdivDelaunay2D’ declared void

 CVAPI(void)  cvInitSubdivDelaunay2D( CvSubdiv2D* subdiv, CvRect rect );

                                      ^

/usr/local/include/opencv2/legacy.hpp:2950:38: error: ‘CvSubdiv2D’ was not declared in this scope

/usr/local/include/opencv2/legacy.hpp:2950:50: error: ‘subdiv’ was not declared in this scope

 CVAPI(void)  cvInitSubdivDelaunay2D( CvSubdiv2D* subdiv, CvRect rect );

                                                  ^

/usr/local/include/opencv2/legacy.hpp:2950:65: error: expected primary-expression before ‘rect’

 CVAPI(void)  cvInitSubdivDelaunay2D( CvSubdiv2D* subdiv, CvRect rect );

                                                                 ^

In file included from /usr/local/include/opencv2/core/core_c.h:48:0,

                 from /usr/local/include/opencv/cv.h:63,

                 from bob/ip/flandmark/flandmark_detector.h:15,

                 from bob/ip/flandmark/flandmark_detector.cpp:17:

/usr/local/include/opencv2/legacy.hpp:2953:1: error: ‘CvSubdiv2D’ does not name a type

 CVAPI(CvSubdiv2D*)  cvCreateSubdiv2D( int subdiv_type, int header_size,

 ^

In file included from /usr/local/include/opencv/cvaux.h:56:0,

                 from bob/ip/flandmark/flandmark_detector.h:16,

                 from bob/ip/flandmark/flandmark_detector.cpp:17:

/usr/local/include/opencv2/legacy.hpp:2960:12: error: ‘CvSubdiv2D’ does not name a type

 CV_INLINE  CvSubdiv2D* cvCreateSubdivDelaunay2D( CvRect rect, CvMemStorage* storage )

            ^

In file included from /usr/local/include/opencv2/core/core_c.h:48:0,

                 from /usr/local/include/opencv/cv.h:63,

                 from bob/ip/flandmark/flandmark_detector.h:15,

                 from bob/ip/flandmark/flandmark_detector.cpp:17:

/usr/local/include/opencv2/legacy.hpp:2971:1: error: ‘CvSubdiv2DPoint’ does not name a type

 CVAPI(CvSubdiv2DPoint*)  cvSubdivDelaunay2DInsert( CvSubdiv2D* subdiv, CvPoint2D32f pt);

 ^

/usr/local/include/opencv2/legacy.hpp:2976:1: error: ‘CvSubdiv2DPointLocation’ does not name a type

 CVAPI(CvSubdiv2DPointLocation)  cvSubdiv2DLocate(

 ^

In file included from /usr/local/include/opencv/cvaux.h:56:0,

                 from bob/ip/flandmark/flandmark_detector.h:16,

                 from bob/ip/flandmark/flandmark_detector.cpp:17:

/usr/local/include/opencv2/legacy.hpp:2982:37: error: variable or field ‘cvCalcSubdivVoronoi2D’ declared void

 CVAPI(void)  cvCalcSubdivVoronoi2D( CvSubdiv2D* subdiv );

                                     ^

/usr/local/include/opencv2/legacy.hpp:2982:37: error: ‘CvSubdiv2D’ was not declared in this scope

/usr/local/include/opencv2/legacy.hpp:2982:49: error: ‘subdiv’ was not declared in this scope

 CVAPI(void)  cvCalcSubdivVoronoi2D( CvSubdiv2D* subdiv );

                                                 ^

/usr/local/include/opencv2/legacy.hpp:2986:38: error: variable or field ‘cvClearSubdivVoronoi2D’ declared void

 CVAPI(void)  cvClearSubdivVoronoi2D( CvSubdiv2D* subdiv );

                                      ^

/usr/local/include/opencv2/legacy.hpp:2986:38: error: ‘CvSubdiv2D’ was not declared in this scope

/usr/local/include/opencv2/legacy.hpp:2986:50: error: ‘subdiv’ was not declared in this scope

 CVAPI(void)  cvClearSubdivVoronoi2D( CvSubdiv2D* subdiv );

                                                  ^

In file included from /usr/local/include/opencv2/core/core_c.h:48:0,

                 from /usr/local/include/opencv/cv.h:63,

                 from bob/ip/flandmark/flandmark_detector.h:15,

                 from bob/ip/flandmark/flandmark_detector.cpp:17:

/usr/local/include/opencv2/legacy.hpp:2990:1: error: ‘CvSubdiv2DPoint’ does not name a type

 CVAPI(CvSubdiv2DPoint*) cvFindNearestPoint2D( CvSubdiv2D* subdiv, CvPoint2D32f pt );

 ^

In file included from /usr/local/include/opencv/cvaux.h:56:0,

                 from bob/ip/flandmark/flandmark_detector.h:16,

                 from bob/ip/flandmark/flandmark_detector.cpp:17:

/usr/local/include/opencv2/legacy.hpp:2995:12: error: ‘CvSubdiv2DEdge’ does not name a type

 CV_INLINE  CvSubdiv2DEdge  cvSubdiv2DNextEdge( CvSubdiv2DEdge edge )

            ^

/usr/local/include/opencv2/legacy.hpp:3001:12: error: ‘CvSubdiv2DEdge’ does not name a type

 CV_INLINE  CvSubdiv2DEdge  cvSubdiv2DRotateEdge( CvSubdiv2DEdge edge, int rotate )

            ^

/usr/local/include/opencv2/legacy.hpp:3006:12: error: ‘CvSubdiv2DEdge’ does not name a type

 CV_INLINE  CvSubdiv2DEdge  cvSubdiv2DSymEdge( CvSubdiv2DEdge edge )

            ^

/usr/local/include/opencv2/legacy.hpp:3011:12: error: ‘CvSubdiv2DEdge’ does not name a type

 CV_INLINE  CvSubdiv2DEdge  cvSubdiv2DGetEdge( CvSubdiv2DEdge edge, CvNextEdgeType type )

            ^

/usr/local/include/opencv2/legacy.hpp:3019:12: error: ‘CvSubdiv2DPoint’ does not name a type

 CV_INLINE  CvSubdiv2DPoint*  cvSubdiv2DEdgeOrg( CvSubdiv2DEdge edge )

            ^

/usr/local/include/opencv2/legacy.hpp:3026:12: error: ‘CvSubdiv2DPoint’ does not name a type

 CV_INLINE  CvSubdiv2DPoint*  cvSubdiv2DEdgeDst( CvSubdiv2DEdge edge )

            ^

error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

----------------------------------------
Cleaning up...
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/bob.ip.flandmark/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-nOl3aD-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_root/bob.ip.flandmark

我如何解决这样的问题?

1 个答案:

答案 0 :(得分:0)

使用Python 3它将解决问题。错误是因为非ASCI字符和python 2.7的默认编码标准不是UTF-8,而Python 3默认编码标准为UTF-8。所以使用最新的Python 3。