Linux中Python的安装、虚拟环境的创建与pycharm的应用

一、python的安装

1. 首先去python官网下载python3的源码包,网址:https://www.python.org/  依次选择:Downloads --> Source code --> 版本3.6.*,下载好之后上传到linux系统,准备安装。

2. python安装之前需要一些必要的模块,如果没有这些模块后来使用会出现一些问题,输入以下命令提前预装依赖包

[root@guarding1 ~]# yum install -y gcc gcc-c++ zlib-devel openssl-devel readline-devel libffi-devel sqlite-devel tcl-devel tk-devel

3. 解压下载的python文件

[root@guarding1 ~]# mkdir python && cd python
[root@guarding1 python]# tar -xzvf Python-3.6.8.tar.gz

4. 进入解压好的目录,在目录下执行./configure --prefix=/usr/local 进行配置python安装路径

[root@guarding1 Python-3.6.8]# ./configure --prefix=/usr/local
[root@guarding1 Python-3.6.8]# ls        #此时Python-3.6.8文件夹中生成了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

5. 编译安装

[root@guarding1 Python-3.6.8]# make && make install

创建python虚拟环境:python3 -m venv ~/mypython

启动虚拟环境:source ~/mypython/bin/active

查看python版本:python --version

查看python位置:which python

6. 下载Pycharm社区版,免费且功能完全能满足日常开发测试

网址:https://www.jetbrains.com/pycharm/download  页面中Community就是社区版

7. 下载好之后,解压文件并且在解压后的目录中进行图形化安装

[root@guarding1 ~]# tar -xzf pycharm-community-2020.1.1.tar.gz
[root@guarding1 ~]# cd pycharm-community-2020.1.1/bin
[root@guarding1 ~]# sh pycharm.sh &

8. 激活Pycharm:在弹出的激活窗口中,选择“License serveer”输入激活服务器地址“http://127.0.0.1:1017”,之后点击‘Activate’,完成pycharm激活。

9. 在pycharm中点击file-->New project-->Location中选择上面创建的mypython环境位置-->Location展开下面的Project interpreter:--> 选择Existing interpreter,点击最右边的设置图标-->选择Add Location-->在interpreter中选择刚刚创建的环境-->OK-->Create

设置字体和风格:file-->Settings-->Editor

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值