我正在尝试使用命令安装 opencv
conda install opencv
此命令在我的笔记本电脑上有效,但当我在台式电脑上尝试时出现以下错误。两个系统都运行 Ubuntu 14.04
Fetching package metadata: ....
Solving package specifications: ....................
Package plan for installation in environment /home/ws2/anaconda2:
The following packages will be downloaded:
package | build
---------------------------|-----------------
openssl-1.0.2e | 0 3.2 MB defaults
sqlite-3.9.2 | 0 3.9 MB defaults
numpy-1.10.2 | py27_0 5.9 MB defaults
requests-2.9.1 | py27_0 605 KB defaults
setuptools-19.4 | py27_0 365 KB defaults
conda-3.19.0 | py27_0 176 KB defaults
opencv-2.4.10 | np110py27_1 9.2 MB defaults
pip-8.0.1 | py27_0 1.5 MB defaults
------------------------------------------------------------
Total: 24.8 MB
The following NEW packages will be INSTALLED:
opencv: 2.4.10-np110py27_1 defaults (soft-link)
The following packages will be UPDATED:
conda: 3.18.8-py27_0 defaults --> 3.19.0-py27_0 defaults (soft-link)
numpy: 1.10.1-py27_0 defaults --> 1.10.2-py27_0 defaults (soft-link)
openssl: 1.0.2d-0 defaults --> 1.0.2e-0 defaults (soft-link)
pip: 7.1.2-py27_0 defaults --> 8.0.1-py27_0 defaults (soft-link)
requests: 2.8.1-py27_0 defaults --> 2.9.1-py27_0 defaults (soft-link)
setuptools: 18.5-py27_0 defaults --> 19.4-py27_0 defaults (soft-link)
sqlite: 3.8.4.1-1 defaults --> 3.9.2-0 defaults (soft-link)
Error: Missing write permissions in: /home/ws2/anaconda2
#
# You don't appear to have the necessary permissions to install packages
# into the install area '/home/ws2/anaconda2'.
# However you can clone this environment into your home directory and
# then make changes to it.
# This may be done using the command:
#
# $ conda create -n my_root --clone=/home/ws2/anaconda2
答案1
问题是,安装“anaconda”的“anaconda2”文件夹被设置为“仅访问”,因为“anaconda2”文件夹的所有者是“root”。现在,我使用命令更改了“anaconda2”文件夹的所有权
sudo chown -R ws2 anaconda
sudo chown -R usr foldername
答案2
请尝试使用 运行您的命令sudo
,如下所示:
sudo conda install opencv
答案3
按照以下命令,并在出现与这些权限相关的问题时进行相应的处理。我在这里所做的是更改了 anaconda 目录中“pkgs”文件夹的所有文件和子文件夹的权限。 sudo chown -R'用户':/home/user/anaconda/pkgs
就你的情况来说这对我有用
sudo chown -R ws2: /home/ws2/anaconda2