Anaconda/Conda創建環境時報錯的解決方案


按照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.


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM