首页 > 其他分享 >test

test

时间:2023-12-03 22:55:06浏览次数:30  
标签:cmake pip3 python usr install test local

centos7.8环境安装opencv-python

 

# 安装好python3.6.9以后要处理python3命令

# ln -s /usr/local/python-3.6.9/bin/pip3 /usr/bin/pip3
# ln -s /usr/local/python-3.6.9/bin/pip3 /usr/local/bin/pip3
# ln -s /usr/local/python-3.6.9/bin/python3 /usr/local/bin/python3

1.升级系统默认的cmake到3.9.2版本

wget https://cmake.org/files/v3.9/cmake-3.9.2.tar.gz
tar xf cmake-3.9.2.tar.gz
cd cmake-3.9.2

# 编译的时候需要直接 --prefix=/usr/local 否则编译的时候会报错 CMake Error: Could not find CMAKE_ROOT !!!

./bootstrap --prefix=/usr/local/
make -j 4 && make install

# 验证是否安装成功
# cmake --version
cmake version 3.9.2

2.安装依赖

pip3 install --upgrade setuptools
pip3 install numpy Matplotlib
pip3 install --upgrade pip
pip3 install scikit-build
pip3 install opencv-python

 

最终的安装信息

复制代码
# pip3 list
Package         Version
--------------- --------
cycler          0.10.0
distro          1.5.0
kiwisolver      1.3.1
matplotlib      3.3.4
numpy           1.19.5
opencv-python   4.5.1.48
packaging       20.9
Pillow          8.1.2
pip             21.0.1
pyparsing       2.4.7
python-dateutil 2.8.1
scikit-build    0.11.1
setuptools      54.2.0
six             1.15.0
wheel           0.36.2
复制代码

验证 opencv-python安装是否成功

# python3
Python 3.6.9 (default, Sep  5 2019, 20:40:16) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-36)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2

 

调试信息
为了方便看报错信息,通过源码安装

cd /usr/local/src
wget https://files.pythonhosted.org/packages/bb/08/9dbc183a3ac6baa95fabf749ddb531bd26256edfff5b6c2195eca26258e9/opencv-python-4.5.1.48.tar.gz
tar xf opencv-python-4.5.1.48.tar.gz
cd opencv-python-4.5.1.48
python3 setup.py install

报错1

Traceback (most recent call last):
  File "setup.py", line 10, in <module>
    import skbuild
ModuleNotFoundError: No module named 'skbuild'

# 解决:

pip3 install scikit-build

# 报错2

复制代码
CMake Error at CMakeLists.txt:27 (cmake_minimum_required):
  CMake 3.5.1 or higher is required.  You are running version 2.8.12.2


-- Configuring incomplete, errors occurred!
Traceback (most recent call last):
  File "/usr/local/python-3.6.9/lib/python3.6/site-packages/skbuild/setuptools_wrap.py", line 586, in setup
    languages=cmake_languages
  File "/usr/local/python-3.6.9/lib/python3.6/site-packages/skbuild/cmaker.py", line 240, in configure
    os.path.abspath(CMAKE_BUILD_DIR())))

An error occurred while configuring with CMake.
复制代码

解决方法:
升级cmake

cd /usr/local/src
wget https://cmake.org/files/v3.9/cmake-3.9.2.tar.gz
tar -zxvf cmake-3.9.2.tar.gz
cd cmake-3.9.2
./bootstrap --prefix=/usr/local/
make -j 4 && make install

报错3

报错3
# 编译安装 opencv-python,方便查看报错信息

复制代码
# python3 setup.py install

/usr/local/python-3.6.9/lib/python3.6/site-packages/setuptools/dist.py:645: UserWarning: Usage of dash-separated 'index-url' will not be supported in future versions. Please use the underscore name 'index_url' instead
  % (opt, underscore_opt))
CMake Error: Could not find CMAKE_ROOT !!!
CMake has most likely not been installed correctly.
Modules directory not found in
/usr/local/share/cmake-3.6
复制代码

解决办法:
安装 cmake时指定到 /usr/local 目录即可
./bootstrap --prefix=/usr/local/

标签:cmake,pip3,python,usr,install,test,local
From: https://www.cnblogs.com/3xiaoleilei/p/17873992.html

相关文章

  • The 13th Shandong ICPC Provincial Collegiate Programming Contest
    Preface昨天VP的那场没有字符串还没有原形毕露,今天遇到一个后期字符串直接和祁神大眼瞪小眼了最后一个半小时祁神狂冲F成功写出两个version的假算法,而我已经滚去补之前欠下的题目了赛后被徐神狠狠拷打了,评价为徐神是我们的红太阳,没有他我们都不能活A.Orders签到,按截止时间......
  • AtCoder Beginner Contest 295
    B-Bombs题意:就是说有一种炸弹,能炸曼哈顿距离的障碍物,要你打印出炸完后的图模拟#include<bits/stdc++.h>usingnamespacestd;charmp[50][50];voidsolve(){ intn,m; cin>>n>>m; for(inti=1;i<=n;i++){ for(intj=1;j<=m;j++){ cin>>mp[i][j]; } } for......
  • AtCoder Beginner Contest 326
    B-326-likeNumbers题意:找到一个不小于n的数是326数,定义是思路:简单的模拟循环即可#include<bits/stdc++.h>usingnamespacestd;boolcheck(intx){ vector<int>a; while(x){ a.push_back(x%10); x/=10; } if(a[1]*a[2]==a[0])returntrue; elsereturnfalse;}......
  • The 2023 ICPC Asia Hefei Regional Contest Test D. Balanced Array
    Preface这题赛场上出了个关键点基本都想到的做法,但因为一个地方卡住了没过去导致不得不选择弃掉这道题赛后补了下发现\(O(n\logn)\)的做法是只差临门一脚了,但\(O(n)\)的做法还是trick性挺强的Solution首先考虑枚举\(k\),不难发现此时合法的前缀一定是个连续的区间,其中区间的......
  • The 2023 ICPC Asia Hefei Regional Contest Test I. Linguistics Puzzle
    Preface这题yysy真不难,但比赛的时候想出做法后没时间写了,只能遗憾地看着倒计时结束Solution直接上爆搜复杂度肯定会爆,考虑有哪些数是可以不用搜直接推出来的首先样例启发我们\(0,1\)这两个数很好确定,因为\(0\)对应的字母单独出现的次数肯定最多,而\(1\)作为两位的开头出现的次......
  • ALGO ARTIS Programming Contest 2023 Autumn(AtCoder Regular Contest 168)
    Preface先补一下这场ARC的博客,因为在来回合肥的路上一直在想这场的CD,所以有空后就先把这场补了A-<Inversion>不难发现对于一段连续的<,设其长度为\(x\),则它最少要贡献\(\frac{x(x+1)}{2}\)的答案而我们很容易构造一种方案刚好满足这个下界,只要让每段的结束比下一段的开头大......
  • The 2021 Sichuan Provincial Collegiate Programming Contest
    Preface下下周还要去打重庆市赛,最近就找些省赛来练练手不得不说省赛的签到题是真的多,人均10+的过题看起来还是很恐怖的这场虽然因为徐神缺席,而且前面的题目都让祁神来写导致罚时略高,但无所谓反正最后也摸到了11题(主要是没有字符串)A.Chuanpai某不知题意的签到#include<bits......
  • 企业级持续集成系列(01):DevTestOps自动化平台设计
     本系列汇总,请查看这里:https://www.cnblogs.com/uncleyong/p/16721826.html 为什么要写企业级持续集成(jenkins+pipeline+k8s)?目前网上自动化持续集成的资料很多,但基本上都是局限于jenkins自由风格的job,结合shell脚本来实现持续集成,这种方式的缺点也很明显:1、构建出问......
  • Pytest:Fixture参数
    Fixture作用域之scope用于控制Fixture的作用范围,作用类似于Pytest的setup/teardownscope参数可以是session,module,class,function,默认为function,作用范围顺序:session》module》class》function名称范围说明function函数级每一个函数或方法都会调用class类级别每个......
  • ORA-01187 cannot read from file 201 because it failed verification tests..temp01
    Description:WegetthismessageinrunningtheUpgradeExpress20-21export(create_customer_data):ORA-01187:cannotreadfromfile201becauseitfailedverificationtestsORA-01110:datafile201:'/exlibris/oradata/aleph20/aleph20_temp01.dbf'O......