1)python安装之前需要一些必要的模块,如果没有这些模块后来使用会出现一些问题,输入以下命令提前预装依赖包:
# yum install -y gcc gcc-c++ zlib-devel openssl-devel readline-devel libffi-devel sqlite-devel tcl-devel tk-devel
释放文件:
#wget https://www.python.org/ftp/python/3.8.13/Python-3.8.13.tgz
# tar -xzf Python-3.8.13.tgz
2)进入Python-3.6.4目录:
# cd Python-3.8.13
#ls #此时 Python-3.8.13文件夹中没有makefile文件
3)配置安装目录:
configure是用来进行用户个性配置的工具,–prefix是说软件安装目录设置在哪里, =/usr/local就是你给出的安装目录
# ./configure --prefix=/usr/local
# ls #此时 Python-3.8.13文件夹中生成了makefile文件
aclocal.m4 configure.ac Mac PC python-config
build Doc Makefile PCbuild python-config.py
CODE_OF_CONDUCT.md Grammar Makefile.pre Programs python-gdb.py
config.guess Include Makefile.pre.in pybuilddir.txt README.rst
config.log install-sh Misc pyconfig.h setup.py
config.status Lib Modules pyconfig.h.in Tools
config.sub libpython3.8.a Objects python
configure LICENSE Parser Python
4)接下来编译源码:
# make
5)执行安装:
# make install
6)、测试正常: ->以下可以看到python版本号
[root@localhost Python-3.8.13]# python3
Python 3.8.13 (default, May 2 2022, 19:26:33)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
接下来安装pycharm
yum update
安装jdk
yum install java
安装xmangager工具,否则无法进行图像显示
yum install virt-manager
下载和解压Pycharm
下载pycharm:
wget https://download.jetbrains.com.cn/python/pycharm-community-2020.1.5.tar.gz
解压安装包:
tar -xvf pycharm-community-2020.1.5.tar.gz
启动pycharm
/root/pycharm/pycharm-2020.1.5/bin/pycharm.sh
添加软连接
ln -s /root/pycharm/pycharm-2020.1.5/bin/pycharm.sh /usr/sbin/pycharm
然后下次就可以直接启动了
pycharm
添加快捷方式
添加桌面快捷方式
gedit /usr/share/applations/Pycharm.desktop [Desktop Entry] Encoding = UTF-8 Name = Pycharm Comment = Pycharm IDE Exec = sh /usr/sbin/pycharm Icon = /root/pycharm-2020.1.5/bin/pycharm.png Terminal = false StartupNotify = ture Type = Application Categories = Application;Development;
保存
最好把/usr/share/applations/Pycharm.desktop该文件复制到桌面即可。
版权声明:本文为weixin_38642722原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。