由于笔者用的是mac pro,
经检查:系统自带了python2
EthanNideMacBook-Pro:~ candy$ python
Python 2.7.10 (default, Aug 17 2018, 19:45:58)
[GCC 4.2.1 Compatible Apple LLVM 10.0.0 (clang-1000.0.42)] on darwin
Type “help”, “copyright”, “credits” or “license” for more information.
检查是否配置了python3
(因为可能有类似于linux系统那种配置了两个java版本,
不过Java环境变量参数只配置了一个)
EthanNideMacBook-Pro:~ candy$ python3
-bash: python3: command not found
计划升级为python3:
安装方法:
安装Homebrew
1.使用Homebrew的包来安装最新的python3版本。
由于Homebrew依赖于Apple的Xcode包。
打开苹果自带的terminal工具
EthanNideMacBook-Pro:~ candy$ xcode-select --install
xcode-select: note: install requested for command line developer tools
弹出窗口点击确认即可。
/usr/bin/ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”
具体命令可参考:https://brew.sh网站。
安装成功:
Already up-to-date.
==> Installation successful!
==> Homebrew has enabled anonymous aggregate formulae and cask analytics.
Read the analytics documentation (and how to opt-out) here:
https://docs.brew.sh/Analytics
==> Homebrew is run entirely by unpaid volunteers. Please consider donating:
https://github.com/Homebrew/brew#donations
==> Next steps:
- Run
brew help
to get started - Further documentation:
https://docs.brew.sh
EthanNideMacBook-Pro:bin candy$ brew doctor
Your system is ready to brew.
//安装成功
可能遇到的报错:
remote: Compressing objects: 100% (80/80), done.
error: RPC failed; curl 56 LibreSSL SSL_read: SSL_ERROR_SYSCALL, errno 54
fatal: the remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
Failed during: git fetch origin master:refs/remotes/origin/master --tags --force
这一个报错是网络连接问题,连上VPN外网后安装即可解决。
安装python
brew install python3
EthanNideMacBook-Pro:~ candy$ brew install python3
Updating Homebrew…
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> Updated Formulae
appscale-tools cassandra@2.1
python3 --version
检查安装结果:
EthanNideMacBook-Pro:~ candy$ python3
Python 3.7.5 (default, Nov 1 2019, 02:16:32)
[Clang 11.0.0 (clang-1100.0.33.8)] on darwin
Type “help”, “copyright”, “credits” or “license” for more information.
恭喜,安装成功。
至于linux系统,网上应该教程很多,按照安装java版本的步骤,应该是网上get java版本,然后设置Java环境变量,生效下就可以了。
window系统可以安装PyCharm软件直接用。