Bash 权限被拒绝

Bash 权限被拒绝

当我~/.bash_profile在终端中使用命令时,我得到了结果

-bash: /Users/hareentej22/.bash_profile: Permission denied

但是当我使用时ls -la ~我得到

total 5272
drwxr-xr-x+  72 hareentej22  staff     2304 Feb 10 19:50 .
drwxr-xr-x    6 root         admin      192 Oct 19 02:53 ..
drwxr-xr-x    3 hareentej22  staff       96 Jan 19 00:16 .3T
-r--------    1 hareentej22  staff        7 Jul  8  2017 .CFUserTextEncoding
-rw-r--r--@   1 hareentej22  staff    20484 Feb 10 18:40 .DS_Store
-rw-r--r--    1 hareentej22  staff   107925 Jan  5 21:52 .RData
-rw-r--r--    1 hareentej22  staff        7 Dec  5 14:20 .Rapp.history
-rw-r--r--    1 hareentej22  staff     5685 Jan 19 15:41 .Rhistory
drwxr-xr-x    3 hareentej22  staff       96 Jul 17  2017 .Seagate
drwx------   79 hareentej22  staff     2528 Feb 10 18:40 .Trash
drwxr-xr-x    3 hareentej22  staff       96 Jan 16 22:17 .anaconda
-rw-------    1 hareentej22  staff    17993 Feb 10 19:57 .bash_history
-rw-r--r--@   1 hareentej22  staff      107 Feb 10 19:50 .bash_profile
-rw-r--r--    1 hareentej22  staff      498 Jan 28 23:19 .bash_profile-anaconda.bak
-rw-r--r--    1 hareentej22  staff        1 Sep 16 20:49 .bash_profile-miniconda3.bak
-rw-r--r--    1 hareentej22  staff      330 Jan 16 22:34 .bash_profile.pysave
drwx------   85 hareentej22  staff     2720 Feb 10 19:58 .bash_sessions
drwxr-xr-x    3 hareentej22  staff       96 Sep 29 18:48 .cache
drwxr-xr-x    3 hareentej22  staff       96 Feb  9 21:00 .cassandra
-rw-------    1 hareentej22  staff        9 Feb 10 01:39 .dbshell
drwxr-xr-x   10 hareentej22  staff      320 Aug 30 23:59 .eclipse
drwxr-xr-x    3 hareentej22  staff       96 Oct 29 12:06 .idlerc
drwxr-xr-x    5 hareentej22  staff      160 Jan 16 23:10 .ipython
drwxr-xr-x    3 hareentej22  staff       96 Feb  5 23:24 .keras
drwxr-xr-x    3 hareentej22  staff       96 Dec 19 16:31 .m2
drwxr-xr-x    4 hareentej22  staff      128 Feb 10 16:13 .matplotlib
drwxr-xr-x    7 hareentej22  staff      224 Sep 29 18:50 .mitmproxy
-rw-------    1 hareentej22  staff        0 Jan 11 00:48 .mongorc.js
-rw-------    1 hareentej22  staff       40 Oct 29 22:58 .mysql_history
drwxr-xr-x    5 hareentej22  staff      160 Dec 19 16:44 .netbeans-derby
drwxr-xr-x   12 hareentej22  staff      384 Feb  8 17:15 .oracle_jre_usage
drwxr-xr-x    8 hareentej22  staff      256 Jan 23 15:48 .p2
-rw-r--r--    1 hareentej22  staff      243 Sep 11 16:41 .profile
drwxr-xr-x    5 hareentej22  staff      160 Sep 14 13:28 .pyenv
-rw-------    1 hareentej22  staff       12 Sep 14 13:30 .python_history
-rw-r--r--    1 hareentej22  staff     1334 Feb  3 15:41 .rediscli_history
drwxr-xr-x   24 hareentej22  staff      768 Feb  8 14:09 .rstudio-desktop
drwxr-xr-x   18 hareentej22  staff      576 Feb 10 16:05 .spyder-py3
drwxr-xr-x    6 hareentej22  staff      192 Dec  5 14:18 .subversion
drwxr-xr-x    3 hareentej22  staff       96 Aug 30 23:48 .tooling
-rw-------    1 hareentej22  staff    15077 Feb 10 18:17 .viminfo
drwxr-xr-x   14 hareentej22  staff      448 Sep 17 03:13 .virtualenvs
-rw-r--r--@   1 hareentej22  staff      569 Jan  7 18:49 20declab.R
-rw-r--r--@   1 hareentej22  staff      550 Jan  7 18:49 20declab1.R
drwx------@   3 hareentej22  staff       96 Jul  9  2017 Applications
drwxrwxr-x@   3 hareentej22  staff       96 Feb 10 11:37 Creative Cloud Files
drwx------+  39 hareentej22  staff     1248 Feb 10 02:54 Desktop
drwx------+  10 hareentej22  staff      320 Jan 19 20:18 Documents
drwx------+ 214 hareentej22  staff     6848 Feb 10 19:16 Downloads
drwxr-xr-x    9 hareentej22  staff      288 Dec 19 16:38 GlassFish_Server
drwx------@  84 hareentej22  staff     2688 Jan 29 21:11 Library
-rw-r--r--    1 hareentej22  staff  1310505 Jan 19 15:24 Makefile
drwx------+   3 hareentej22  staff       96 Jul  8  2017 Movies
drwx------+   4 hareentej22  staff      128 Jul  8  2017 Music
drwxr-xr-x    5 hareentej22  staff      160 Feb  1 14:36 NetBeansProjects
drwxr-xr-x    2 hareentej22  staff       64 Jul 29  2017 Parallels
drwx------+   8 hareentej22  staff      256 Jan 19 20:18 Pictures
drwxr-xr-x+   5 hareentej22  staff      160 Jul  8  2017 Public
drwxr-xr-x   10 hareentej22  staff      320 Nov 10 00:19 Sites
-rwxr-xr-x    1 hareentej22  staff     3222 Jan 19 15:24 bk-deps
-rwxr-xr-x    1 hareentej22  staff     1712 Jan 19 15:24 bk-make-pch
-rwxr-xr-x    1 hareentej22  staff      205 Jan 19 15:23 change-install-names
-rw-r--r--    1 hareentej22  staff   193608 Jan 19 15:24 config.log
-rwxr-xr-x    1 hareentej22  staff    84831 Jan 19 15:24 config.status
-rw-r--r--    1 hareentej22  staff        0 Jan 19 15:23 configarg.cache
drwxr-xr-x    6 hareentej22  staff      192 Jan 19 15:24 contrib
drwxr-xr-x    5 hareentej22  staff      160 Jan 19 14:52 eclipse
drwxr-xr-x    3 hareentej22  staff       96 Jan 19 15:24 lib
drwxr-xr-x   73 hareentej22  staff     2336 Jan 19 15:24 samples
-rwxr-xr-x    1 hareentej22  staff     2085 Jan 19 15:24 shared-ld-sh
drwxr-xr-x    9 hareentej22  staff      288 Jan 19 15:24 utils
lrwxr-xr-x    1 hareentej22  staff       42 Jan 19 15:24 wx-config -> lib/wx/config/inplace-mac-ansi-release-2.8

今天早些时候,我弄乱了我的 keras 库,所以我想完全卸载 anaconda 和 python3.6。然后我brew update && brew reinstall python在输出中使用它说

This formula installs a python2 executable to /usr/local/bin.
If you wish to have this formula's python executable in your PATH then add
the following to ~/.bash_profile:
  export PATH="/usr/local/opt/python/libexec/bin:$PATH"

因此设置路径~/.bash_profile命令会拒绝权限

我查看了一些已经回答过的类似问题。我发现我只能通过使用来设置路径,open -e .bash_profile 但我记得在 bash shell 中通过命令设置路径~/.bash_profile

答案1

您想要的命令是:

source ~/.bash_profile

相关内容