THE FOUNDER’S GUIDE:
How to Install C++ Programs From Source Code in WSL2
The condensed tutorial with instructions and screenshots
The expanded version of this article explains each step with enough detail to learn what’s happening.
Open PowerShell:
- Press “⊞ Windows”
- Enter “PowerShell” into the search bar
- Right-click “Windows PowerShell”
- Click “Run as Administrator”
Open WSL:
- Copy the command from below these instructions
- Paste the command into PowerShell
- Press “Enter”
wsl
Set the Username Variable:
- Copy the command from below these instructions
- Paste the command into PowerShell
- Press “Enter”
username=$(wslvar USERNAME)
Open the Desktop Directory:
- Copy the command from below these instructions
- Paste the command into PowerShell
- Press “Enter”
cd /mnt/c/users/$username/desktop
Clone the Repository:
- Copy the command from below these instructions
- Paste the command into PowerShell
- Press “Enter”
git clone https://github.com/pjreddie/darknet
Open the Darknet Directory:
- Copy the command from below these instructions
- Paste the command into PowerShell
- Press “Enter”
cd darknet
Install the Dependencies:
- Copy the command from below these instructions
- Paste the command into PowerShell
- Press “Enter”
sudo apt-get install libopencv-dev
The following five steps are only necessary on computers that have a GPU — not just a CPU.
Open the MakeFile:
- Copy the command from below these instructions
- Paste the command into PowerShell
- Press “Enter”
powershell.exe -c 'notepad $home\desktop\darknet\makefile'
Enable CUDA:
- Find the arrow from below these instructions
- Copy the code to the left of the arrow
- Paste over the code in Notepad
- Click the “File” menu
- Click “Save”
Change the CUDA Paths:
- Find the arrows from below these instructions
- Copy the code to the left of the arrows
- Paste over the code into Notepad
- Click the “File” menu
- Click “Save”
- Click the “File” menu
- Click “Exit”
Open the Bash Configuration File:
- Copy the command from below these instructions
- Paste the command into PowerShell
- Press “Enter”
notepad //wsl$/Ubuntu-18.04/home/$USER/.bashrc
Edit the Bash Configuration File:
- Find the arrows from below these instructions
- Copy the code to the left of the arrow
- Paste the code into Notepad
- Click the “File” menu
- Click “Save”
- Click the “File” menu
- Click “Exit”
Install Dos2Unix:
- Copy the command from below these instructions
- Paste the command into PowerShell
- Press “Enter”
sudo apt-get install dos2unix
Convert the Configuration Files to Unix:
- Copy the command from below these instructions
- Paste the command into PowerShell
- Press “Enter”
dos2unix cfg/*
Convert the CoCo File to Unix:
- Copy the command from below these instructions
- Paste the command into PowerShell
- Press “Enter”
dos2unix data/coco.names
Run the MakeFile:
- Copy the command from below these instructions
- Paste the command into PowerShell
- Press “Enter”
make
Download the Weights:
- Copy the command from below these instructions
- Paste the command into PowerShell
- Press “Enter”
wget https://pjreddie.com/media/files/yolov3.weights
Run YoloV3:
- Copy the command from below these instructions
- Paste the command into PowerShell
- Press “Enter”
./darknet detect cfg/yolov3.cfg yolov3.weights data/dog.jpg
Next Steps:
This article is part of a mini-series that helps readers set up everything they need to start using WSL2 for artificial intelligence, machine learning, deep learning, and or data science. It includes articles that contain instructions with copy and paste code and screenshots that help readers get the outcome as soon as possible. It also includes articles that contain instructions with explanations and screenshots that help readers process what’s happening.
01. Install Windows Subsystem for Linux 2 (WSL2)
02. Install the NVIDIA CUDA Driver and Toolkit in WSL2
03. Install Software From Source Code in WSL2
04. Install the Jupyter Notebook Home and Public Server in WSL2
05. Install Virtual Environments in Jupyter Notebook in WSL2
06. Install Programs With a Graphical User Interface in WSL2
07. Install Ubuntu Desktop With a Graphical User Interface in WSL2
Hopefully, this article helped everyone get the prize. If you want to help out then hold the “👋” and click “Follow” to get more content. Thanks for reading!