python安裝出錯(cuò)記錄

安裝

1、xcode9.3 ?macOS 10.13.4

在終端輸入:?brew install python3

2、安裝完報(bào)錯(cuò)

Error: An unexpected error occurred during the `brew link` step

The formula built, but is not symlinked into /usr/local

Permission denied @ dir_s_mkdir - /usr/local/Frameworks

Error: Permission denied @ dir_s_mkdir - /usr/local/Frameworks

執(zhí)行brew doctor

查看出錯(cuò)原因

?? ~ brew doctor

Please note that these warnings are just used to help the Homebrew maintainers

with debugging if you file an issue. If everything you use Homebrew for is

working fine: please don't worry or file an issue; just ignore this. Thanks!

Warning: You have unlinked kegs in your Cellar

Leaving kegs unlinked can lead to build-trouble and cause brews that depend on

those kegs to fail to run properly once built. Run `brew link` on these:

? python

Warning: Your Xcode (9.2) is outdated.

Please update to Xcode 9.3 (or delete it).

Xcode can be updated from the App Store.

Warning: Some installed formulae are missing dependencies.

You should `brew install` the missing dependencies:

? brew install python@2

Run `brew missing` for more details.

python3已安裝,no t link

?? ~ sudo mkdir /usr/local/Frameworks

Password:

mkdir: /usr/local/Frameworks: File exists

?? ~ sudo chown $(whoami):admin /usr/local/Frameworks

?? ~brew link python3? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?

Linking /usr/local/Cellar/python/3.6.5... 1 symlinks created

此時(shí)安裝完成??

3、中文編碼出錯(cuò)的問題

>>> '中文'.encode('utf-8')

Traceback (most recent call last):

? File "", line 1, in

UnicodeDecodeError: 'ascii' codec can't decode byte 0xe4 in position 0: ordinal not in range(128)

解決辦法:

>>> import sys

>>> reload(sys)

>>> sys.setdefaultencoding('utf8')

>>> '中文'.encode('utf-8')

'\xe4\xb8\xad\xe6\x96\x87'

>>>?

此處應(yīng)有??

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容