Linux系统安装Python3环境.docx
Linux系统安装Python3环境 Linux系统安装Python3环境是指在Linux操作系统中安装Python 3.x版本的环境。下面将详细介绍安装Python 3.x的步骤和注意事项。 1. 查看Linux默认安装的Python版本 在Linux系统中,默认情况下已经安装了Python 2.7.5,可以通过运行`python --version`命令来查看当前Python版本。 2. 查看Linux默认安装的Python位置 在Linux系统中,Python的位置在/usr/bin/python和/usr/bin/python2,都是软链接,/usr/bin/python指向/usr/bin/python2,而/usr/bin/python2最终又指向/usr/bin/python2.7。 3. 安装Python 3.x 安装Python 3.x需要下载Python 3.x的源代码包,例如Python 3.6.5,然后将其上传到Linux系统的某个目录下,例如/root/tools目录下。 解压缩Python 3.x源代码包可以使用`tar -zxvf Python-3.6.5.tgz`命令,然后将其解压缩到当前目录下。 4. 准备编译环境 在编译Python 3.x之前,需要安装一些依赖项,例如zlib-devel、bzip2-devel、openssl-devel、ncurses-devel、sqlite-devel、readline-devel、tk-devel、gcc、make、gdbm-devel、db4-devel、libpcap-devel、xz-devel、libffi-devel等。 可以使用`yum -y install`命令来安装这些依赖项,例如: ``` yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make gdbm-devel db4-devel libpcap-devel xz-devel libffi-devel ``` 这些依赖项都是必不可少的,例如不安装libffi-devel就会导致pandas导入时报错。 5. 编译Python 3.x 在安装所有依赖项后,可以使用`./configure`和`make`命令来编译Python 3.x,整个编译过程大约需要1分钟。 如果在编译过程中遇到问题,可以使用解决方案,例如执行`vi /etc/sysconfig/ne`命令来解决无法连接外网的问题。 安装Python 3.x环境需要下载Python 3.x的源代码包,安装依赖项,编译Python 3.x,并解决可能遇到的问题。
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![](https://csdnimg.cn/release/download_crawler_static/88053929/bg1.jpg)
![avatar-default](https://csdnimg.cn/release/downloadcmsfe/public/img/lazyLogo2.1882d7f4.png)
![avatar](https://profile-avatar.csdnimg.cn/4ebba96334014d67b7bf3f601143192f_weixin_40991408.jpg!1)
- 粉丝: 4272
- 资源: 442
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![voice](https://csdnimg.cn/release/downloadcmsfe/public/img/voice.245cc511.png)
![center-task](https://csdnimg.cn/release/downloadcmsfe/public/img/center-task.c2eda91a.png)
最新资源
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback-tip](https://img-home.csdnimg.cn/images/20220527035111.png)
![dialog-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/green-success.6a4acb44.png)