按照Conda網站上的提示安裝完Conda之后,想要用conda create創建環境,一直報錯:
ERROR conda.core.link:_execute_actions(337): An error occurred while installing package 'defaults::dbus-1.10.10-0'.
PermissionError(13, 'Permission denied')
Attempting to roll back.
PermissionError(13, 'Permission denied')
看樣子是安裝軟件包的權限問題。但問題是安裝Conda的時候,並沒有使用sudo或切換到root下安裝,而是直接使用當前用戶安裝,最后Conda也是被安裝在當前用戶的目錄下。所以感覺不應該是權限的問題。
但事實就是權限的問題。
我們用ls -l ~/會發現:
.
.
drwxr-xr-x 20 root root 4096 Jun 6 10:22 anaconda3
.
.
用戶目錄下_anaconda3_文件夾的owner是root,而不是當前用戶!實在是非常奇怪。目前我還不知道為什么會這樣,但是解決方法就很容易了:
sudo chown -R <USER> anaconda3
這時候再用conda create,就不會報錯了,可以順利創建環境。
When I use Conda to create new environment, it displayed:
ERROR conda.core.link:_execute_actions(337): An error occurred while installing package 'defaults::dbus-1.10.10-0'.
PermissionError(13, 'Permission denied')
Attempting to roll back.
PermissionError(13, 'Permission denied')
I finally found that this was because the USER did not have the permission to access the installed Anaconda directory. When I typed ls -l ~/, I found:
drwxr-xr-x 20 root root 4096 Jun 6 10:22 anaconda3
which was very strange. The owner of anaconda3 is root instead of USER, though I did not use root to install Anaconda. So I sudo chown -R <USER> anaconda3. Solved. Now I can use conda create to create new environment.
