安装jdk

关闭防火墙:systemclt stop firewalld

设置开机启动:systemctl enable firewalld

设置手动启动:systemctl disenable firewalld

下载jdk软件包

解压

[root@localhost ~]# tar -zxvf jdk-22_linux-x64_bin.tar.gz

解压后的文件夹移动到/usr/local

找到可执行文件

[root@localhost ~]#ls /usr/local/

在profile中配置jdk环境变量

[root@localhost ~]# vi /etc/profile

将java的可执行文件添加到¥PATH环境变量中

配置JAVA_HOME=/usr/local/jdk22/

[root@localhost ~]# source /etc/profile

[root@localhost ~]# java -version

[root@localhost ~]# cd /usr/local/

[root@localhost local]# ls

[root@localhost local]# cd jdk-22.0.1/

[root@localhost jdk-22.0.1]# ls

[root@localhost jdk-22.0.1]# cd bin/

[root@localhost bin]# ./java -jar /root/todolist.jar

数据分析 python2 with open(“a.txt”,“wb”)as f:

                           f.write (“writer”)

[root@localhost bin]# whereis python

python: /usr/bin/python /usr/bin/python2.7 /usr/lib/python2.7 /usr/lib64/python2.7 /etc/python /usr/include/python2.7 /usr/share/man/man1/python.1.gz

[root@localhost bin]# python2

>>> print("hello world")

hello world

>>> print("1+2=",3)

('1+2=', 3)

>>> quit()

安装python3软件包

[root@localhost bin]# yum list|grep python

[root@localhost bin]# python

Python 2.7.5 (default, Apr 11 2018, 07:36:10)

[GCC 4.8.5 20150623 (Red Hat 4.8.5-28)] on linux2

Type "help", "copyright", "credits" or "license" for more information.

>>> with open("a.txt","web") as f:

...     f.write("python是一个相对容易的脚本")

... ls

>>> ls

Traceback (most recent call last):

  File "<stdin>", line 1, in <module>

NameError: name 'ls' is not defined

>>>

>>> with open("b.txt","wb") as f:

...     f.write("我,秦始皇,打钱")

...

>>> import os

>>> os.listdir("./")

['jar', 'jarsigner', 'java', 'javac', 'javadoc', 'javap', 'jcmd', 'jconsole', 'jdb', 'jdeprscan', 'jdeps', 'jfr', 'jhsdb', 'jimage', 'jinfo', 'jlink', 'jmap', 'jmod', 'jpackage', 'jps', 'jrunscript', 'jshell', 'jstack', 'jstat', 'jstatd', 'keytool', 'rmiregistry', 'serialver', 'b.txt']

  • 6
    点赞
  • 18
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值