Install
- Install Anaconda. (e.g. by default in
C:\Users\tommyhu\anaconda3
) - Add the following paths to Path:
C:\Users\tommyhu\anaconda3
C:\Users\tommyhu\anaconda3\Scripts
Add libs
Online install
Install directly
1 | conda install xxx |
Via Anaconda cloud
- Search the lib on Anaconda Cloud
- Use the command listed on the lib page
Take OpenCV as an example, run
1
conda install -c conda-forge opencv
Offline install
tar.bz2
type1
- Download lib of type
tar.bz2
(e.g. search Anaconda Cloud)Note: download the lib with correct PC versions, including
- Python (e.g. lib name contains like
py37
), which can be checked on PC via cmd1
python
- CUDA (e.g. lib name contains like
cuda92
), which can be checked on PC via cmd1
nvcc --version
- Python (e.g. lib name contains like
- Install in cmd
1
conda install --use-local xxx.tar.bz2
whl
type
Some
whl
libs are available at Unofficial Windows Binaries for Python Extension Packages | dlib.
- Download lib of type
whl
(must match local Python and CUDA versions as above) - Install in cmd
1
pip install xx.whl
From source
Take dlib as an example
- Download its source here (e.g. dlib-19.19.0.tar.gz).
- Extract it and run cmd (may need to run twice) in the folder
1
python setup.py install
Run
- Run Anaconda Command Prompt or cmd (with
activate
command). - Change to the folder that contains the Python file that you want (assume xxx.py) to run.
- Run
1
python xxx.py
Case study
With Anaconda-3 (integrated with Python v3.7), installing OpenCV+CUDA+CUDNN+Torch on my laptop (with NVIDIA GeForce GTX 1050) will be like:1
2
3
4
5
6
7
8conda install --use-local "<_lib_folder_>\opencv-3.4.2-py37h6fd60c2_0.tar.bz2"
conda install --use-local "<_lib_folder_>\py-opencv-3.4.2-py37hc319ecb_0.tar.bz2"
conda install --use-local "<_lib_folder_>\libopencv-3.4.2-h20b85fd_0.tar.bz2"
conda install --use-local "<_lib_folder_>\cudatoolkit-10.0.130-0.tar.bz2"
conda install --use-local "<_lib_folder_>\cudnn-7.6.5-cuda10.0_0.tar.bz2"
conda install --use-local "<_lib_folder_>\pytorch-1.2.0-py3.7_cuda100_cudnn7_1.tar.bz2"
conda install --use-local "<_lib_folder_>\pytorch-gpu-1.3.1-0.tar.bz2"
conda install --use-local "<_lib_folder_>\torchvision-0.4.0-py37_cu100.tar.bz2"
1. Conda install 本地压缩包文件tar.bz2 ↩