freepic-1523588156147.jpg
問題描述:
使用 brew upgrade
升級軟件,同時解決了python的問題:
【Mac】使用brew upgrade 升級 python 后的報錯解決
httpie 使用時會顯示如下問題:
http GET http://localhost:5000/prosrv/language/published
dyld: Library not loaded: @executable_path/../.Python
Referenced from: /usr/local/Cellar/httpie/0.9.9_3/libexec/bin/python3.6
Reason: image not found
[1] 12882 trace trap http --pretty all GET http://localhost:5000/prosrv/language/published
具體原因是 /usr/local/Cellar/httpie/0.9.9_3/libexec/bin/../.Python
目錄無法找到。進入到目錄:/usr/local/Cellar/httpie/0.9.9_3/libexec
$ cd /usr/local/Cellar/httpie/0.9.9_3/libexec
$ ls -al
total 16
drwxr-xr-x 7 long admin 238 12 9 2016 .
drwxr-xr-x 10 long admin 340 4 13 10:18 ..
lrwxr-xr-x 1 long admin 70 12 9 2016 .Python -> ../../../../opt/python/Frameworks/Python.framework/Versions/3.6/Python
drwxr-xr-x 18 long admin 612 4 13 10:18 bin
drwxr-xr-x 3 long admin 102 12 9 2016 include
drwxr-xr-x 3 long admin 102 12 9 2016 lib
-rw-r--r-- 1 long admin 60 12 9 2016 pip-selfcheck.json
可以看到 .Python
使用的是 /usr/local/opt/python
目錄,由于:【Mac】使用brew upgrade 升級 python 后的報錯解決 的原因,/usr/local/opt/python
已經由 python3 變為了Python2,因此 .Python
目錄是不存在的。
解決辦法
重新鏈接 .Python
目錄:
$ cd /usr/local/Cellar/httpie/0.9.9_3/libexec
$ ln ../../../../opt/python3/Frameworks/Python.framework/Versions/3.6/Python .Python
$ ls -al
total 24
drwxr-xr-x 8 long admin 272B 4 13 10:46 .
drwxr-xr-x 10 long admin 340B 4 13 10:18 ..
lrwxr-xr-x 1 long admin 71B 4 13 10:46 .Python -> ../../../../opt/python3/Frameworks/Python.framework/Versions/3.6/Python
lrwxr-xr-x 1 long admin 70B 12 9 2016 .Python.bk -> ../../../../opt/python/Frameworks/Python.framework/Versions/3.6/Python
drwxr-xr-x 18 long admin 612B 4 13 10:18 bin
drwxr-xr-x 3 long admin 102B 12 9 2016 include
drwxr-xr-x 3 long admin 102B 12 9 2016 lib
-rw-r--r-- 1 long admin 60B 12 9 2016 pip-selfcheck.json
重新鏈接后,httpie 就可以正常使用了。