ubuntu 16.04 安装 python2.7 以及 cv2, dist-package 和 site-package 的区别, import cv2 出问题解答
2018-02-25 18:46
597 查看
ubuntu16.04默认安装python3以上,需要手动安装2.7。
1、先确保make、gcc、g++已经安装好,如果没有则需要先安装这三个程序,均使用apt-get的方式直接装;2、下载python2.7包: wget https://www.python.org/ftp/python/2.7.13/Python-2.7.13.tgz3、解压该包: tar -xvf Python-2.7.13.tgz4、进入该包: cd Python-2.7.135、./configure6、make7、make install安装完毕,如果因为权限问题失败,需要加sudo。
sudo apt-get install 安装的package存放在 /usr/lib/python2.7/dist-packages目录中
pip 或者 easy_install安装的package存放在/usr/local/lib/python2.7/dist-packages目录中
手动从源代码安装的package存放在site-packages目录中
The dist-packages is a Debian-specific convention that is also present in its derivatives, like Ubuntu. Modules are installed to dist-packages when they come from the Debian package manager into this location:
cv2:
pip install opencv-python
import cv2 出问题解决:
sudo ldconfig http://blog.sina.com.cn/s/blog_4ddef8f80102v57b.html http://www.cnblogs.com/world-for-gold/p/6837782.html
1、先确保make、gcc、g++已经安装好,如果没有则需要先安装这三个程序,均使用apt-get的方式直接装;2、下载python2.7包: wget https://www.python.org/ftp/python/2.7.13/Python-2.7.13.tgz3、解压该包: tar -xvf Python-2.7.13.tgz4、进入该包: cd Python-2.7.135、./configure6、make7、make install安装完毕,如果因为权限问题失败,需要加sudo。
sudo apt-get install 安装的package存放在 /usr/lib/python2.7/dist-packages目录中
pip 或者 easy_install安装的package存放在/usr/local/lib/python2.7/dist-packages目录中
手动从源代码安装的package存放在site-packages目录中
The dist-packages is a Debian-specific convention that is also present in its derivatives, like Ubuntu. Modules are installed to dist-packages when they come from the Debian package manager into this location:
/usr/lib/python2.7/dist-packagesSince
easy_installand
pipare installed from the package manager, they also use dist-packages, but they put packages here:
/usr/local/lib/python2.7/dist-packagesFrom the Debian Python Wiki:dist-packages instead of site-packages. Third party Python software installed from Debian packages goes into dist-packages, not site-packages. This is to reduce conflict between the system Python, and any from-source Python build you might install manually.This means that if you manually install Python from source, it uses the site-packages directory. This allows you to keep the two installations separate, especially since Debian and Ubuntu rely on the system version of Python for many system utilities.
cv2:
pip install opencv-python
import cv2 出问题解决:
sudo ldconfig http://blog.sina.com.cn/s/blog_4ddef8f80102v57b.html http://www.cnblogs.com/world-for-gold/p/6837782.html
相关文章推荐
- Ubuntu16.04下在Python2.7安装OpenCV3.2.0出现的问题与解决办法
- Ubuntu16.04下安装Anaconda3过程python3.6使用,以及重新建立新的Python2.7并安装tensorflow-gpu,测试并成功。
- ubuntu16.04安装caffe以及各种问题汇总
- ubuntu16.04无法连接无线的问题解决方式以及QQ的安装
- 自己安装虚拟机vbox+ubuntu16.04+opencv3.2.0+python2.7+caffe+CPUonly的全过程整理
- 为Ubuntu 16.04 添加永久免费https SSL证书(解决python2.7 - pip wheel failed with error code 2 问题)
- Ubuntu 16.04 安装 docker 以及出现的问题
- Ubuntu 16.04上安装 Swift 3.0及问题解答
- linux安装OpenCV以及windows安装numpy、cv2等python2.7模块
- Ubuntu下自带Python2.7同时安装Anoconda3要注意的问题
- Ubuntu16.04LTS+python 2.7安装tensorflow+keras,以及运行实例
- Python 安装路径, dist-packages 和 site-packages 区别
- ubuntu 16.04 安装nodejs 以及问题整理
- [Centos] mod_wsgi 安装流程以及遇到问题解决办法。apxs: command not found 或 Sorry, Python developer package does not appear to be installed.
- Ubuntu 16.04安装Nvidia显卡驱动:在安装N卡驱动的过程中,我遇到了不少问题,例如安装后会出现循环登录问题,以及登录后桌面显示不完整(启动器消失,任务栏消失),打不开系统设置等问题。
- Ubuntu下Python的MySQLdb的安装以及常见问题的解决
- Python在ubuntu上面的安装,遇到的问题,以及一些有用的python库安装
- ubuntu Python2.7 安装PIL问题
- Ubuntu16.04自带Python2.7和Python3,为什么用pip安装的包在Python3中不能用
- caffe安装的过程(ubuntu16.04+GTX1060),以及问题分析