背景:
碰到的问题:
主要是python2.*下输入问题
Name = input(‘姓名’)
输入 字符串,报错
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<string>", line 1, in <module>
NameError: name 'admin' is not defined
原因及解决办法:
在python2.x中raw_input()和input(),两个函数都存在区别是
raw_input() —将所有输入作为字符串看待,返回字符串类型
input() —只能接受 “数字”的输入,返回(int float)
python3的安装:
1.Homebrew的安装;
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
当然一般情况下这个是不太行的,因为一些网络问题,下载失败,所以可以用国内镜像安装
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
2.python3的下载
brew install python3
我这里用的是vscode,坐下脚选择python的版本
点击,路径为
/usr/local/Cellar/python
在这个文件下的bin文件中选择python3
到此,就不用在为上面的问题犯愁了。
-----------------------------------------------------------------------分割线------------------------------------------------------------------------------------------
怎么安装,直接上官网下载python的安装包,双击安装
https://www.cnblogs.com/1009-smile/p/8005524.html