简体   繁体   中英

Permission Error in Installing OpenCV in Anaconda

i'm new to python anaconda. i decide to install opencv library to work on computer vision by this command :

conda install -c menpo opencv

but i face with this error :

## Package Plan ##

  environment location: C:\ProgramData\Anaconda3

  added / updated specs:
    - opencv


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    libopencv-3.4.2            |       h20b85fd_0        37.4 MB
    hdf5-1.8.20                |       hac2f561_1        26.7 MB
    opencv-3.4.2               |   py36h40b0b35_0          10 KB
    py-opencv-3.4.2            |   py36hc319ecb_0         1.5 MB
    ------------------------------------------------------------
                                           Total:        65.5 MB

The following NEW packages will be INSTALLED:

    blas:            1.0-mkl
    libopencv:       3.4.2-h20b85fd_0
    opencv:          3.4.2-py36h40b0b35_0
    py-opencv:       3.4.2-py36hc319ecb_0

The following packages will be UPDATED:

    ca-certificates: 2017.08.26-h94faf87_0 --> 2018.03.07-0
    certifi:         2018.1.18-py36_0      --> 2018.8.24-py36_1
    numpy:           1.14.0-py36h4a99626_1 --> 1.14.2-py36h5c71026_0
    openssl:         1.0.2n-h74b6da3_0     --> 1.0.2p-hfa6e2cd_0

The following packages will be DOWNGRADED:

    hdf5:            1.10.1-h98b8871_1     --> 1.8.20-hac2f561_1

Proceed ([y]/n)?


Downloading and Extracting Packages
libopencv 3.4.2: ############################################################################################## | 100%
hdf5 1.8.20: ################################################################################################## | 100%
opencv 3.4.2: ################################################################################################# | 100%
py-opencv 3.4.2: ############################################################################################## | 100%
Preparing transaction: done
Verifying transaction: done
Executing transaction: failed
ERROR conda.core.link:_execute(481): An error occurred while uninstalling package 'defaults::numpy-1.14.0-py36h4a99626_1'.
PermissionError(13, 'Access is denied')
Attempting to roll back.

Rolling back transaction: done

PermissionError(13, 'Access is denied')

i'm running the command in Anaconda Prompt. is there any solution ? i tried many other installation command but above error shows up many times. my Python is 3.6 , i use conda info command , and you can see the result below :

     active environment : base
    active env location : C:\ProgramData\Anaconda3
            shell level : 1
       user config file : C:\Users\Mohammad\.condarc
 populated config files : C:\Users\Mohammad\.condarc
          conda version : 4.4.10
    conda-build version : 3.4.1
         python version : 3.6.4.final.0
       base environment : C:\ProgramData\Anaconda3  (read only)
           channel URLs : https://repo.continuum.io/pkgs/main/win-64
                          https://repo.continuum.io/pkgs/main/noarch
                          https://repo.continuum.io/pkgs/free/win-64
                          https://repo.continuum.io/pkgs/free/noarch
                          https://repo.continuum.io/pkgs/r/win-64
                          https://repo.continuum.io/pkgs/r/noarch
                          https://repo.continuum.io/pkgs/pro/win-64
                          https://repo.continuum.io/pkgs/pro/noarch
                          https://repo.continuum.io/pkgs/msys2/win-64
                          https://repo.continuum.io/pkgs/msys2/noarch
          package cache : C:\ProgramData\Anaconda3\pkgs
                          C:\Users\Mohammad\AppData\Local\conda\conda\pkgs
       envs directories : C:\Users\Mohammad\AppData\Local\conda\conda\envs
                          C:\ProgramData\Anaconda3\envs
                          C:\Users\Mohammad\.conda\envs
               platform : win-64
             user-agent : conda/4.4.10 requests/2.18.4 CPython/3.6.4 Windows/10 Windows/10.0.10586
          administrator : False
             netrc file : None
           offline mode : False

You are installing conda package into "read only" directory so the permission error occur.

You have 2 choice to overcome this problem

  1. Grant yourself a administrator permission .

  2. Install local package into different directory inwhich you have write permission

    conda install -c menpo opencv -p YOUR_DIRECTORY

I myself prefer a 3rd choice

  1. Create for yourself a new python virtual environment inside directory inwhich you have write permission and use it

    Create your env

    $ conda create -n YOUR_ENV -p YOUR_DIRECTORY python=2.7

    Load it

    source activate YOUR_ENV

    Install opencv

    $ conda install opencv

Hope that help

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM