安装
1、xcode9.3 macOS 10.13.4
在终端输入: brew install python3
2、安装完报错
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
执行brew doctor
查看出错原因
➜ ~ 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
此时安装完成👏
3、中文编码出错的问题
>>> '中文'.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'
>>>
此处应有👏
网友评论