SlideShare a Scribd company logo
1 of 9
Download to read offline
10/5/2019 OpenCV_Linux_Installation_Guide - Google Docs
https://docs.google.com/document/d/1LC6XlasyLBa21YvGfipwcheRSzab3f_PqUBiRsFIB30/edit 1/9
 
Preparing Ubuntu 18.x-Based Linux 
for Using OpenCV 4.1, 
Python 3.7.x and PyCharm 2018.3.x 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Professor Shohreh Kasaei 
pkasaei@gmail.com 
 
Written by Nader Karimi 
Nader.karimi.b@gmail.com 
 
Digital Image Processing Course 
Spring, 2019 
Sharif University of Technology 
 
10/5/2019 OpenCV_Linux_Installation_Guide - Google Docs
https://docs.google.com/document/d/1LC6XlasyLBa21YvGfipwcheRSzab3f_PqUBiRsFIB30/edit 2/9
Installing Python 3.7 on Ubuntu 18.x-based Linux 
 
Installing python 3.7 
Run the sequence of commands below: 
 
sudo apt update 
sudo apt install software-properties-common 
sudo add-apt-repository ppa:deadsnakes/ppa 
sudo apt install python3.7 
 
 
If those commands run successfully, you can run Python 3.7 by typing: 
 
python3.7 
 
 
 
If you want to use python3.7, be sure to type its name completely. If you just type python3, you 
may start python 3.6.x instead. 
 
Finding the absolute path to the python interpreter 
You can find the path to the installed interpreter by typing: 
 
which python3.7 
 
Which in my case is: 
 
/usr/bin/python3.7 
 
Installing pip 
You should install pip, which is a powerful package manager for python. Here is how to install 
for python3: 
 
sudo apt install python3-pip 
   
2 
10/5/2019 OpenCV_Linux_Installation_Guide - Google Docs
https://docs.google.com/document/d/1LC6XlasyLBa21YvGfipwcheRSzab3f_PqUBiRsFIB30/edit 3/9
Installing and Using Virtual Environments for Python 
 
Installing virtualenv 
 
python3.7 -m pip install --user virtualenv 
 
Creating a new virtualenv with python3.7 as the default python interpreter 
First, create a directory for storing your virtual environments’ data. You can use your home 
directory for example: 
 
cd 
mkdir myenvs 
cd myenvs 
 
Now you are in the right path to create a new virtualenv. Create a new one by typing: 
 
python3.7 -m virtualenv env 
 
Activating a virtualenv 
First, change your working directory to the environments folder. In our case: 
 
cd ~/myenvs 
 
Then activate the environment you want, for example “env”, by typing: 
 
source env/bin/activate 
 
Your terminal should look like this after activating a virtualenv: 
Note that we just typed “python” without version number and we could start python 3.7. 
If you check python’s absolute path, you will notice that it is now pointing to a file in the specific 
virtualenv directory that is activated: 
 
/home/nader/env/bin/python 
 
Sometime it will still point to the system-wide python interpreter. If that happened for you, it’s ok. 
 
 
3 
10/5/2019 OpenCV_Linux_Installation_Guide - Google Docs
https://docs.google.com/document/d/1LC6XlasyLBa21YvGfipwcheRSzab3f_PqUBiRsFIB30/edit 4/9
Deactivating the virtualenv 
Use this simple command to deactivate the activated virtualenv: 
 
deactivate   
4 
10/5/2019 OpenCV_Linux_Installation_Guide - Google Docs
https://docs.google.com/document/d/1LC6XlasyLBa21YvGfipwcheRSzab3f_PqUBiRsFIB30/edit 5/9
Installing and Using Anaconda for Scientific 
Programming with Python 
 
Downloading and Installing Anaconda 
Download Anaconda for Linux from here. Don’t forget to choose Python 3.7 version. 
Change your directory to the download folder. Then enter the command below (check to see if 
the name of your file is different): 
 
bash Anaconda3-5.2.0-Linux-x86_64.sh 
 
and answer to the prompts till you finish installing it. 
 
Creating a new virtualenv with python3.7.2 as the default python using conda 
Conda is the package manager, somehow similar to pip, which comes with Anaconda. We can 
create and manage virtual environments with it, too. 
Here we create a new virtual environment using conda. We specify that we want the python to 
be version 3.7.2, although we have not installed this version on our machine. Conda will handle 
downloading and installing it for us! Also, we don’t need to think about where to store our 
virtualenvs since conda has a default path for that. 
 
Type these command to create a new virtualenv named “cenv” (which stands for conda env): 
 
conda create -n cenv python=3.7.2 
 
Finish the process by answering to the prompts it gives you. Note that we specify the name of 
the virtualenv after “-n”. 
 
Activating and deactivating a virtualenv using conda 
We show how to activate and deactivate virtualenvs in the picture below. See how easy it is to 
activate and deactivate a virtualenv using the command “source”. We don’t have to worry about 
any system path while working with conda virtualenvs. 
Note that instead of the command ‘source’, you can use the equivalent command ‘conda’. For 
example, instead of using: 
source activate 
you can use: 
conda activate 
5 
10/5/2019 OpenCV_Linux_Installation_Guide - Google Docs
https://docs.google.com/document/d/1LC6XlasyLBa21YvGfipwcheRSzab3f_PqUBiRsFIB30/edit 6/9
   
6 
10/5/2019 OpenCV_Linux_Installation_Guide - Google Docs
https://docs.google.com/document/d/1LC6XlasyLBa21YvGfipwcheRSzab3f_PqUBiRsFIB30/edit 7/9
Installing OpenCV 4.1 in an Activated Virtualenv 
First, activate the virtualenv you want to use. Then type this command to install opencv version 
4.x.x (the latest version will be installed): 
 
pip install opencv-python 
 
For installing other versions, find the appropriate command from this link. 
You can check if it is installed correctly like this: 
   
7 
10/5/2019 OpenCV_Linux_Installation_Guide - Google Docs
https://docs.google.com/document/d/1LC6XlasyLBa21YvGfipwcheRSzab3f_PqUBiRsFIB30/edit 8/9
Installing and Configuring PyCharm for Using a Virtual 
Environment 
 
First, download PyCharm from here. You may want to download the free, community edition file. 
Next, unzip the tar.gz file using this command: 
 
tar -xvzf pycharm_filename.tar.gz 
 
Then go to PyCharm folder, and next to the “bin” folder and start pycharm like this: 
 
 
Note that there is a file named “Install-Linux-tar.txt” in the PyCharm folder. You can check that 
for further information about using PyCharm. 
 
As we like to work with virtualenvs, we should instruct PyCharm to use our desired virtualenv. 
You can use the pictures below for guidance. Start PyCharm and create a new project. Open 
the Project Interpreter drop-down menu, choose existing interpreter and click on the button right 
to it. Another windows will pop up. There is a button right to the Interpreter text field. Click on 
that, and in the opened window, enter the path of the python interpreter of your virtualenv. You 
can find that path by using “which” command, as explained before. Commit this changes and 
finish making the new project. 
8 
10/5/2019 OpenCV_Linux_Installation_Guide - Google Docs
https://docs.google.com/document/d/1LC6XlasyLBa21YvGfipwcheRSzab3f_PqUBiRsFIB30/edit 9/956
 
Finally, you can create a launcher for PyCharm, so that you won’t have to start it from 
command-line each time. Start PyCharm, go to tools, and click on “Create Desktop Entry …”. 
Enjoy! 
9 

More Related Content

What's hot

Docker & Kubernetes
Docker & KubernetesDocker & Kubernetes
Docker & KubernetesTroy Harvey
 
Node.js, Vagrant, Chef, and Mathoid @ Benetech
Node.js, Vagrant, Chef, and Mathoid @ BenetechNode.js, Vagrant, Chef, and Mathoid @ Benetech
Node.js, Vagrant, Chef, and Mathoid @ BenetechChristopher Bumgardner
 
uWSGI - Swiss army knife for your Python web apps
uWSGI - Swiss army knife for your Python web appsuWSGI - Swiss army knife for your Python web apps
uWSGI - Swiss army knife for your Python web appsTomislav Raseta
 
Vagrant step-by-step guide for Beginners
Vagrant step-by-step guide for BeginnersVagrant step-by-step guide for Beginners
Vagrant step-by-step guide for BeginnersSagar Acharya
 
Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to Docker皓鈞 張
 
Simple webapps with nginx, uwsgi emperor and bottle
Simple webapps with nginx, uwsgi emperor and bottleSimple webapps with nginx, uwsgi emperor and bottle
Simple webapps with nginx, uwsgi emperor and bottleJordi Soucheiron
 
TYPO3 CMS deployment with Jenkins CI
TYPO3 CMS deployment with Jenkins CITYPO3 CMS deployment with Jenkins CI
TYPO3 CMS deployment with Jenkins CIderdanne
 
Python virtualenv & pip in 90 minutes
Python virtualenv & pip in 90 minutesPython virtualenv & pip in 90 minutes
Python virtualenv & pip in 90 minutesLarry Cai
 
Ohio Linux Fest 2013: Provisioning VMs Quickly with Vagrant and CFEngine
Ohio Linux Fest 2013: Provisioning VMs Quickly with Vagrant and CFEngineOhio Linux Fest 2013: Provisioning VMs Quickly with Vagrant and CFEngine
Ohio Linux Fest 2013: Provisioning VMs Quickly with Vagrant and CFEngineNick Anderson
 
Meetup C++ Floripa - Conan.io
Meetup C++ Floripa - Conan.ioMeetup C++ Floripa - Conan.io
Meetup C++ Floripa - Conan.ioUilian Ries
 
Run Docker On Windows Using Vagrant
Run Docker On Windows Using VagrantRun Docker On Windows Using Vagrant
Run Docker On Windows Using VagrantJulien Barbier
 
Pip + virtualenv
Pip + virtualenvPip + virtualenv
Pip + virtualenvDaryl Yu
 
Continuous Delivery di una WebApp - by example
Continuous Delivery di una WebApp - by exampleContinuous Delivery di una WebApp - by example
Continuous Delivery di una WebApp - by exampleFabio Mora
 
Terminus, the Pantheon command-line interface
Terminus, the Pantheon command-line interfaceTerminus, the Pantheon command-line interface
Terminus, the Pantheon command-line interfaceJon Peck
 
Arbeiten mit distribute, pip und virtualenv
Arbeiten mit distribute, pip und virtualenvArbeiten mit distribute, pip und virtualenv
Arbeiten mit distribute, pip und virtualenvMarkus Zapke-Gründemann
 
Big Fat FastPlone - Scale up, speed up
Big Fat FastPlone - Scale up, speed upBig Fat FastPlone - Scale up, speed up
Big Fat FastPlone - Scale up, speed upJens Klein
 
Towards the perfect Drupal Dev Machine
Towards the perfect Drupal Dev MachineTowards the perfect Drupal Dev Machine
Towards the perfect Drupal Dev MachineKrimson
 

What's hot (20)

Docker & Kubernetes
Docker & KubernetesDocker & Kubernetes
Docker & Kubernetes
 
Node.js, Vagrant, Chef, and Mathoid @ Benetech
Node.js, Vagrant, Chef, and Mathoid @ BenetechNode.js, Vagrant, Chef, and Mathoid @ Benetech
Node.js, Vagrant, Chef, and Mathoid @ Benetech
 
uWSGI - Swiss army knife for your Python web apps
uWSGI - Swiss army knife for your Python web appsuWSGI - Swiss army knife for your Python web apps
uWSGI - Swiss army knife for your Python web apps
 
Security Testing Using Infrastructure-As-Code
Security Testing Using Infrastructure-As-CodeSecurity Testing Using Infrastructure-As-Code
Security Testing Using Infrastructure-As-Code
 
Vagrant step-by-step guide for Beginners
Vagrant step-by-step guide for BeginnersVagrant step-by-step guide for Beginners
Vagrant step-by-step guide for Beginners
 
Docker perl build
Docker perl buildDocker perl build
Docker perl build
 
Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to Docker
 
Simple webapps with nginx, uwsgi emperor and bottle
Simple webapps with nginx, uwsgi emperor and bottleSimple webapps with nginx, uwsgi emperor and bottle
Simple webapps with nginx, uwsgi emperor and bottle
 
TYPO3 CMS deployment with Jenkins CI
TYPO3 CMS deployment with Jenkins CITYPO3 CMS deployment with Jenkins CI
TYPO3 CMS deployment with Jenkins CI
 
Python virtualenv & pip in 90 minutes
Python virtualenv & pip in 90 minutesPython virtualenv & pip in 90 minutes
Python virtualenv & pip in 90 minutes
 
Ohio Linux Fest 2013: Provisioning VMs Quickly with Vagrant and CFEngine
Ohio Linux Fest 2013: Provisioning VMs Quickly with Vagrant and CFEngineOhio Linux Fest 2013: Provisioning VMs Quickly with Vagrant and CFEngine
Ohio Linux Fest 2013: Provisioning VMs Quickly with Vagrant and CFEngine
 
Meetup C++ Floripa - Conan.io
Meetup C++ Floripa - Conan.ioMeetup C++ Floripa - Conan.io
Meetup C++ Floripa - Conan.io
 
Run Docker On Windows Using Vagrant
Run Docker On Windows Using VagrantRun Docker On Windows Using Vagrant
Run Docker On Windows Using Vagrant
 
Pip + virtualenv
Pip + virtualenvPip + virtualenv
Pip + virtualenv
 
Continuous Delivery di una WebApp - by example
Continuous Delivery di una WebApp - by exampleContinuous Delivery di una WebApp - by example
Continuous Delivery di una WebApp - by example
 
Virtualenv
VirtualenvVirtualenv
Virtualenv
 
Terminus, the Pantheon command-line interface
Terminus, the Pantheon command-line interfaceTerminus, the Pantheon command-line interface
Terminus, the Pantheon command-line interface
 
Arbeiten mit distribute, pip und virtualenv
Arbeiten mit distribute, pip und virtualenvArbeiten mit distribute, pip und virtualenv
Arbeiten mit distribute, pip und virtualenv
 
Big Fat FastPlone - Scale up, speed up
Big Fat FastPlone - Scale up, speed upBig Fat FastPlone - Scale up, speed up
Big Fat FastPlone - Scale up, speed up
 
Towards the perfect Drupal Dev Machine
Towards the perfect Drupal Dev MachineTowards the perfect Drupal Dev Machine
Towards the perfect Drupal Dev Machine
 

Similar to Installing OpenCV 4 on Ubuntu 18.x

A Hands-On Set of Programming Problems Using Python and OpenCV
A Hands-On Set of Programming Problems Using Python and OpenCVA Hands-On Set of Programming Problems Using Python and OpenCV
A Hands-On Set of Programming Problems Using Python and OpenCVNader Karimi
 
Steps to install ns3
Steps to install ns3Steps to install ns3
Steps to install ns3DIGITAL PADM
 
AWS EC2 Ubuntu Instance - Step-by-Step Deployment Guide
AWS EC2 Ubuntu Instance - Step-by-Step Deployment GuideAWS EC2 Ubuntu Instance - Step-by-Step Deployment Guide
AWS EC2 Ubuntu Instance - Step-by-Step Deployment GuideRapidValue
 
5 minute intro to virtualenv
5 minute intro to virtualenv5 minute intro to virtualenv
5 minute intro to virtualenvamenasse
 
Installing Python on Mac
Installing Python on MacInstalling Python on Mac
Installing Python on MacWei-Wen Hsu
 
Software Quality Assurance Tooling 2023
Software Quality Assurance Tooling 2023Software Quality Assurance Tooling 2023
Software Quality Assurance Tooling 2023Henry Schreiner
 
Princeton Wintersession: Software Quality Assurance Tooling
Princeton Wintersession: Software Quality Assurance ToolingPrinceton Wintersession: Software Quality Assurance Tooling
Princeton Wintersession: Software Quality Assurance ToolingHenry Schreiner
 
Mpeg guide
Mpeg  guideMpeg  guide
Mpeg guidekimsach
 
Installation of ubuntu, ns3 and compiling first
Installation of ubuntu, ns3 and compiling firstInstallation of ubuntu, ns3 and compiling first
Installation of ubuntu, ns3 and compiling firstJawad Khan
 
Ansible Workshop for Pythonistas
Ansible Workshop for PythonistasAnsible Workshop for Pythonistas
Ansible Workshop for PythonistasMihai Criveti
 
Nuxeo5 - Continuous Integration
Nuxeo5 - Continuous IntegrationNuxeo5 - Continuous Integration
Nuxeo5 - Continuous IntegrationPASCAL Jean Marie
 
Software Quality Assurance Tooling - Wintersession 2024
Software Quality Assurance Tooling - Wintersession 2024Software Quality Assurance Tooling - Wintersession 2024
Software Quality Assurance Tooling - Wintersession 2024Henry Schreiner
 
PVS-Studio in the Clouds: Travis CI
PVS-Studio in the Clouds: Travis CIPVS-Studio in the Clouds: Travis CI
PVS-Studio in the Clouds: Travis CIAndrey Karpov
 
Digital RSE: automated code quality checks - RSE group meeting
Digital RSE: automated code quality checks - RSE group meetingDigital RSE: automated code quality checks - RSE group meeting
Digital RSE: automated code quality checks - RSE group meetingHenry Schreiner
 
Drupalcamp es 2013 drupal with lxc docker and vagrant
Drupalcamp es 2013  drupal with lxc docker and vagrant Drupalcamp es 2013  drupal with lxc docker and vagrant
Drupalcamp es 2013 drupal with lxc docker and vagrant Ricardo Amaro
 
Continuous Delivery w projekcie Open Source - Marcin Stachniuk - DevCrowd 2017
Continuous Delivery w projekcie Open Source - Marcin Stachniuk - DevCrowd 2017Continuous Delivery w projekcie Open Source - Marcin Stachniuk - DevCrowd 2017
Continuous Delivery w projekcie Open Source - Marcin Stachniuk - DevCrowd 2017MarcinStachniuk
 
Installing nagios core_from_source
Installing nagios core_from_sourceInstalling nagios core_from_source
Installing nagios core_from_sourcelaonap166
 
Orangescrum In App Chat Add-on User Manual
Orangescrum In App Chat Add-on User ManualOrangescrum In App Chat Add-on User Manual
Orangescrum In App Chat Add-on User ManualOrangescrum
 

Similar to Installing OpenCV 4 on Ubuntu 18.x (20)

A Hands-On Set of Programming Problems Using Python and OpenCV
A Hands-On Set of Programming Problems Using Python and OpenCVA Hands-On Set of Programming Problems Using Python and OpenCV
A Hands-On Set of Programming Problems Using Python and OpenCV
 
Steps to install ns3
Steps to install ns3Steps to install ns3
Steps to install ns3
 
AWS EC2 Ubuntu Instance - Step-by-Step Deployment Guide
AWS EC2 Ubuntu Instance - Step-by-Step Deployment GuideAWS EC2 Ubuntu Instance - Step-by-Step Deployment Guide
AWS EC2 Ubuntu Instance - Step-by-Step Deployment Guide
 
5 minute intro to virtualenv
5 minute intro to virtualenv5 minute intro to virtualenv
5 minute intro to virtualenv
 
Installing Python on Mac
Installing Python on MacInstalling Python on Mac
Installing Python on Mac
 
Software Quality Assurance Tooling 2023
Software Quality Assurance Tooling 2023Software Quality Assurance Tooling 2023
Software Quality Assurance Tooling 2023
 
Princeton Wintersession: Software Quality Assurance Tooling
Princeton Wintersession: Software Quality Assurance ToolingPrinceton Wintersession: Software Quality Assurance Tooling
Princeton Wintersession: Software Quality Assurance Tooling
 
Mpeg guide
Mpeg  guideMpeg  guide
Mpeg guide
 
Installation of ubuntu, ns3 and compiling first
Installation of ubuntu, ns3 and compiling firstInstallation of ubuntu, ns3 and compiling first
Installation of ubuntu, ns3 and compiling first
 
LIGGGHTS installation-guide
LIGGGHTS installation-guideLIGGGHTS installation-guide
LIGGGHTS installation-guide
 
Python Projects at Neova
Python Projects at NeovaPython Projects at Neova
Python Projects at Neova
 
Ansible Workshop for Pythonistas
Ansible Workshop for PythonistasAnsible Workshop for Pythonistas
Ansible Workshop for Pythonistas
 
Nuxeo5 - Continuous Integration
Nuxeo5 - Continuous IntegrationNuxeo5 - Continuous Integration
Nuxeo5 - Continuous Integration
 
Software Quality Assurance Tooling - Wintersession 2024
Software Quality Assurance Tooling - Wintersession 2024Software Quality Assurance Tooling - Wintersession 2024
Software Quality Assurance Tooling - Wintersession 2024
 
PVS-Studio in the Clouds: Travis CI
PVS-Studio in the Clouds: Travis CIPVS-Studio in the Clouds: Travis CI
PVS-Studio in the Clouds: Travis CI
 
Digital RSE: automated code quality checks - RSE group meeting
Digital RSE: automated code quality checks - RSE group meetingDigital RSE: automated code quality checks - RSE group meeting
Digital RSE: automated code quality checks - RSE group meeting
 
Drupalcamp es 2013 drupal with lxc docker and vagrant
Drupalcamp es 2013  drupal with lxc docker and vagrant Drupalcamp es 2013  drupal with lxc docker and vagrant
Drupalcamp es 2013 drupal with lxc docker and vagrant
 
Continuous Delivery w projekcie Open Source - Marcin Stachniuk - DevCrowd 2017
Continuous Delivery w projekcie Open Source - Marcin Stachniuk - DevCrowd 2017Continuous Delivery w projekcie Open Source - Marcin Stachniuk - DevCrowd 2017
Continuous Delivery w projekcie Open Source - Marcin Stachniuk - DevCrowd 2017
 
Installing nagios core_from_source
Installing nagios core_from_sourceInstalling nagios core_from_source
Installing nagios core_from_source
 
Orangescrum In App Chat Add-on User Manual
Orangescrum In App Chat Add-on User ManualOrangescrum In App Chat Add-on User Manual
Orangescrum In App Chat Add-on User Manual
 

Recently uploaded

Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfproinshot.com
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdfPearlKirahMaeRagusta1
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfryanfarris8
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension AidPhilip Schwarz
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnAmarnathKambale
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024Mind IT Systems
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech studentsHimanshiGarg82
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 

Recently uploaded (20)

Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 

Installing OpenCV 4 on Ubuntu 18.x

  • 1. 10/5/2019 OpenCV_Linux_Installation_Guide - Google Docs https://docs.google.com/document/d/1LC6XlasyLBa21YvGfipwcheRSzab3f_PqUBiRsFIB30/edit 1/9   Preparing Ubuntu 18.x-Based Linux  for Using OpenCV 4.1,  Python 3.7.x and PyCharm 2018.3.x                                          Professor Shohreh Kasaei  pkasaei@gmail.com    Written by Nader Karimi  Nader.karimi.b@gmail.com    Digital Image Processing Course  Spring, 2019  Sharif University of Technology   
  • 2. 10/5/2019 OpenCV_Linux_Installation_Guide - Google Docs https://docs.google.com/document/d/1LC6XlasyLBa21YvGfipwcheRSzab3f_PqUBiRsFIB30/edit 2/9 Installing Python 3.7 on Ubuntu 18.x-based Linux    Installing python 3.7  Run the sequence of commands below:    sudo apt update  sudo apt install software-properties-common  sudo add-apt-repository ppa:deadsnakes/ppa  sudo apt install python3.7      If those commands run successfully, you can run Python 3.7 by typing:    python3.7        If you want to use python3.7, be sure to type its name completely. If you just type python3, you  may start python 3.6.x instead.    Finding the absolute path to the python interpreter  You can find the path to the installed interpreter by typing:    which python3.7    Which in my case is:    /usr/bin/python3.7    Installing pip  You should install pip, which is a powerful package manager for python. Here is how to install  for python3:    sudo apt install python3-pip      2 
  • 3. 10/5/2019 OpenCV_Linux_Installation_Guide - Google Docs https://docs.google.com/document/d/1LC6XlasyLBa21YvGfipwcheRSzab3f_PqUBiRsFIB30/edit 3/9 Installing and Using Virtual Environments for Python    Installing virtualenv    python3.7 -m pip install --user virtualenv    Creating a new virtualenv with python3.7 as the default python interpreter  First, create a directory for storing your virtual environments’ data. You can use your home  directory for example:    cd  mkdir myenvs  cd myenvs    Now you are in the right path to create a new virtualenv. Create a new one by typing:    python3.7 -m virtualenv env    Activating a virtualenv  First, change your working directory to the environments folder. In our case:    cd ~/myenvs    Then activate the environment you want, for example “env”, by typing:    source env/bin/activate    Your terminal should look like this after activating a virtualenv:  Note that we just typed “python” without version number and we could start python 3.7.  If you check python’s absolute path, you will notice that it is now pointing to a file in the specific  virtualenv directory that is activated:    /home/nader/env/bin/python    Sometime it will still point to the system-wide python interpreter. If that happened for you, it’s ok.      3 
  • 4. 10/5/2019 OpenCV_Linux_Installation_Guide - Google Docs https://docs.google.com/document/d/1LC6XlasyLBa21YvGfipwcheRSzab3f_PqUBiRsFIB30/edit 4/9 Deactivating the virtualenv  Use this simple command to deactivate the activated virtualenv:    deactivate    4 
  • 5. 10/5/2019 OpenCV_Linux_Installation_Guide - Google Docs https://docs.google.com/document/d/1LC6XlasyLBa21YvGfipwcheRSzab3f_PqUBiRsFIB30/edit 5/9 Installing and Using Anaconda for Scientific  Programming with Python    Downloading and Installing Anaconda  Download Anaconda for Linux from here. Don’t forget to choose Python 3.7 version.  Change your directory to the download folder. Then enter the command below (check to see if  the name of your file is different):    bash Anaconda3-5.2.0-Linux-x86_64.sh    and answer to the prompts till you finish installing it.    Creating a new virtualenv with python3.7.2 as the default python using conda  Conda is the package manager, somehow similar to pip, which comes with Anaconda. We can  create and manage virtual environments with it, too.  Here we create a new virtual environment using conda. We specify that we want the python to  be version 3.7.2, although we have not installed this version on our machine. Conda will handle  downloading and installing it for us! Also, we don’t need to think about where to store our  virtualenvs since conda has a default path for that.    Type these command to create a new virtualenv named “cenv” (which stands for conda env):    conda create -n cenv python=3.7.2    Finish the process by answering to the prompts it gives you. Note that we specify the name of  the virtualenv after “-n”.    Activating and deactivating a virtualenv using conda  We show how to activate and deactivate virtualenvs in the picture below. See how easy it is to  activate and deactivate a virtualenv using the command “source”. We don’t have to worry about  any system path while working with conda virtualenvs.  Note that instead of the command ‘source’, you can use the equivalent command ‘conda’. For  example, instead of using:  source activate  you can use:  conda activate  5 
  • 6. 10/5/2019 OpenCV_Linux_Installation_Guide - Google Docs https://docs.google.com/document/d/1LC6XlasyLBa21YvGfipwcheRSzab3f_PqUBiRsFIB30/edit 6/9     6 
  • 7. 10/5/2019 OpenCV_Linux_Installation_Guide - Google Docs https://docs.google.com/document/d/1LC6XlasyLBa21YvGfipwcheRSzab3f_PqUBiRsFIB30/edit 7/9 Installing OpenCV 4.1 in an Activated Virtualenv  First, activate the virtualenv you want to use. Then type this command to install opencv version  4.x.x (the latest version will be installed):    pip install opencv-python    For installing other versions, find the appropriate command from this link.  You can check if it is installed correctly like this:      7 
  • 8. 10/5/2019 OpenCV_Linux_Installation_Guide - Google Docs https://docs.google.com/document/d/1LC6XlasyLBa21YvGfipwcheRSzab3f_PqUBiRsFIB30/edit 8/9 Installing and Configuring PyCharm for Using a Virtual  Environment    First, download PyCharm from here. You may want to download the free, community edition file.  Next, unzip the tar.gz file using this command:    tar -xvzf pycharm_filename.tar.gz    Then go to PyCharm folder, and next to the “bin” folder and start pycharm like this:      Note that there is a file named “Install-Linux-tar.txt” in the PyCharm folder. You can check that  for further information about using PyCharm.    As we like to work with virtualenvs, we should instruct PyCharm to use our desired virtualenv.  You can use the pictures below for guidance. Start PyCharm and create a new project. Open  the Project Interpreter drop-down menu, choose existing interpreter and click on the button right  to it. Another windows will pop up. There is a button right to the Interpreter text field. Click on  that, and in the opened window, enter the path of the python interpreter of your virtualenv. You  can find that path by using “which” command, as explained before. Commit this changes and  finish making the new project.  8 
  • 9. 10/5/2019 OpenCV_Linux_Installation_Guide - Google Docs https://docs.google.com/document/d/1LC6XlasyLBa21YvGfipwcheRSzab3f_PqUBiRsFIB30/edit 9/956   Finally, you can create a launcher for PyCharm, so that you won’t have to start it from  command-line each time. Start PyCharm, go to tools, and click on “Create Desktop Entry …”.  Enjoy!  9