conda安装包时提示当前用户没有权限
运行之前的一段代码时突然提醒statsmodels需要的pasty库没安装
conda install -c anaconda patsy
在服务器上安装pasty库时失败,报错当前用户没有权限修改anaconda3文件夹,报错如下:
Collecting package metadata (current_repodata.json): done
Solving environment: done
## Package Plan ##
environment location: /usr/local/anaconda3
added / updated specs:
- patsy
The following packages will be downloaded:
package | build
---------------------------|-----------------
certifi-2020.6.20 | py37_0 159 KB anaconda
patsy-0.5.1 | py37_0 375 KB anaconda
------------------------------------------------------------
Total: 534 KB
The following NEW packages will be INSTALLED:
patsy anaconda/linux-64::patsy-0.5.1-py37_0
The following packages will be SUPERSEDED by a higher-priority channel:
ca-certificates pkgs/main::ca-certificates-2021.4.13-~ --> anaconda::ca-certificates-2020.10.14-0
certifi pkgs/main::certifi-2020.12.5-py37h06a~ --> anaconda::certifi-2020.6.20-py37_0
Proceed ([y]/n)? y
Downloading and Extracting Packages
patsy-0.5.1 | 375 KB | ##################################### | 100%
certifi-2020.6.20 | 159 KB | ##################################### | 100%
Preparing transaction: done
Verifying transaction: failed
EnvironmentNotWritableError: The current user does not have write permissions to the target environment.
environment location: /usr/local/anaconda3
uid: 1001
gid: 1002
解决方案:首先进入anaconda3文件夹
``
cd /usr/local/anaconda3
然后为当前用户授权可以更改anaconda3文件夹
sudo chown -R jdong /usr/local/anaconda3
再次安装
conda install -c anaconda patsy
成功
Collecting package metadata (current_repodata.json): done
Solving environment: done
## Package Plan ##
environment location: /usr/local/anaconda3
added / updated specs:
- patsy
The following NEW packages will be INSTALLED:
patsy anaconda/linux-64::patsy-0.5.1-py37_0
The following packages will be SUPERSEDED by a higher-priority channel:
ca-certificates pkgs/main::ca-certificates-2021.4.13-~ --> anaconda::ca-certificates-2020.10.14-0
certifi pkgs/main::certifi-2020.12.5-py37h06a~ --> anaconda::certifi-2020.6.20-py37_0
Proceed ([y]/n)? y
Preparing transaction: done
Verifying transaction: done
Executing transaction: done