关闭防火墙: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']