1 案例1:准备python开发环境
1.1 问题
下载最新版本的python3
下载pycharm社区版
安装python3,使其支持Tab键补全
配置pycharm,使其符合自己的习惯
- 1
- 2
- 3
- 4
1.2 步骤
实现此案例需要按照如下步骤进行。
步骤一:下载最新版python3
首先去python官网下载python3的源码包,网址:https://www.python.org/
进去之后点击导航栏的Downloads,也可以鼠标放到Downloads上弹出菜单选择Source code,表示源码包,这里选择最新版本3.6.4,这里选择第一个下载即可,下载的就是源码包:Python-3.6.4.tar.gz,下载好之后上传到linux系统,准备安装,如图-1所示:
图-1
步骤二:Linux下安装python3
1)python安装之前需要一些必要的模块,如果没有这些模块后来使用会出现一些问题,输入以下命令提前预装依赖包:
[root@localhost ~]# yum install -y gcc gcc-c++ zlib-devel openssl-devel readline-devel libffi-devel sqlite-devel tcl-devel tk-devel
- 1
释放文件:
[root@localhost python]# tar -xzf Python-3.6.4.tar.gz
- 1
2)进入Python-3.6.4目录:
[root@localhost python]# cd Python-3.6.4
[root@localhost Python-3.6.4]#ls #此时Python-3.6.4文件夹中没有makefile文件
- 1
- 2
3)配置安装目录:
configure是用来进行用户个性配置的工具,–prefix是说软件安装目录设置在哪里, =/usr/local就是你给出的安装目录
[root@localhost Python-3.6.4]# ./configure --prefix=/usr/local
[root@localhost Python-3.6.4]# ls #此时Python-3.6.4文件夹中生成了makefile文件
aclocal.m4 Doc Makefile PCbuild python-config.py
build 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.6m.a Objects python
configure LICENSE Parser Python
configure.ac Mac PC python-config
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
4)接下来编译源码:
[root@localhost Python-3.6.4]# make
- 1
5)执行安装:
[root@localhost Python-3.6.4]# make install
- 1
整个过程大约5-10分钟,安装成功
步骤三:下载并安装Pycharm社区版
网址:https://www.jetbrains.com/pycharm/download,这里选择下图红框下载即可,下载好之后上传到linux系统,准备安装,如图-2所示:
图-2
2)释放文件:
[root@localhost ~]# tar -xzf pycharm-community-2018.1.1.tar.gz
- 1
3)运行下面的命令进入PyCharm 目录:
[root@localhost pycharm-community-2018.1.1]# cd pycharm-community-2018.1.1/bin
- 1
4)通过运行下面的命令来运行PyCharm进入图形化安装界面:
[root@localhost bin]# sh pycharm.sh &
- 1
5)Pycharm打开后,如果你需要导入之前安装版本的设置的话,可以选择第一个选项,如果没有的话,选择(Do not import settings)默认不导入设置,点击/同意,就可以进入pycharm进行配置,如图-3所示:
图-3
6)激活Pycharm:在弹出的激活窗口中,选择“License serveer”输入激活服务器地址“http://127.0.0.1:1017”,之后点击‘Activate’,完成pycharm激活,如图-4所示:
图-4
7)启动完成进入欢迎界面,如图-5所示:
图-5
</div>
<link href="https://csdnimg.cn/release/phoenix/mdeditor/markdown_views-60ecaf1f42.css" rel="stylesheet">
<div class="more-toolbox">
<div class="left-toolbox">
<ul class="toolbox-list">
<li class="tool-item tool-active is-like "><a href="javascript:;"><svg class="icon" aria-hidden="true">
<use xlink:href="#csdnc-thumbsup"></use>
</svg><span class="name">点赞</span>
<span class="count"></span>
</a></li>
<li class="tool-item tool-active is-collection "><a href="javascript:;" data-report-click="{"mod":"popu_824"}"><svg class="icon" aria-hidden="true">
<use xlink:href="#icon-csdnc-Collection-G"></use>
</svg><span class="name">收藏</span></a></li>
<li class="tool-item tool-active is-share"><a href="javascript:;" data-report-click="{"mod":"1582594662_002"}"><svg class="icon" aria-hidden="true">
<use xlink:href="#icon-csdnc-fenxiang"></use>
</svg>分享</a></li>
<!--打赏开始-->
<!--打赏结束-->
<li class="tool-item tool-more">
<a>
<svg t="1575545411852" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5717" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M179.176 499.222m-113.245 0a113.245 113.245 0 1 0 226.49 0 113.245 113.245 0 1 0-226.49 0Z" p-id="5718"></path><path d="M509.684 499.222m-113.245 0a113.245 113.245 0 1 0 226.49 0 113.245 113.245 0 1 0-226.49 0Z" p-id="5719"></path><path d="M846.175 499.222m-113.245 0a113.245 113.245 0 1 0 226.49 0 113.245 113.245 0 1 0-226.49 0Z" p-id="5720"></path></svg>
</a>
<ul class="more-box">
<li class="item"><a class="article-report">文章举报</a></li>
</ul>
</li>
</ul>
</div>
</div>
<div class="person-messagebox">
<div class="left-message"><a href="https://blog.csdn.net/xie_qi_chao">
<img src="https://profile.csdnimg.cn/B/F/6/3_xie_qi_chao" class="avatar_pic" username="xie_qi_chao">
<img src="https://g.csdnimg.cn/static/user-reg-year/1x/2.png" class="user-years">
</a></div>
<div class="middle-message">
<div class="title"><span class="tit"><a href="https://blog.csdn.net/xie_qi_chao" data-report-click="{"mod":"popu_379"}" target="_blank">解启超</a></span>
</div>
<div class="text"><span>发布了404 篇原创文章</span> · <span>获赞 56</span> · <span>访问量 4万+</span></div>
</div>
<div class="right-message">
<a href="https://im.csdn.net/im/main.html?userName=xie_qi_chao" target="_blank" class="btn btn-sm btn-red-hollow bt-button personal-letter">私信
</a>
<a class="btn btn-sm attented bt-button personal-watch" data-report-click="{"mod":"popu_379"}">已关注</a>
</div>
</div>
</div>
</article>