Python3.6源码编译安装
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Python3.6源码编译安装相关的知识,希望对你有一定的参考价值。
-
下载安装Python-3.6.5包
[[email protected] ~]# wget https://www.python.org/ftp/python/3.6.5/Python-3.6.5.tgz
-
解压包
[[email protected] ~]#tar xf Python-3.6.5.tgz
-
进入目录并设置路径
[[email protected] ~]cd Python-3.6.5/ && ./configure --prefix=/usr/local/python36
-
编译安装
[[email protected] Python-3.6.5]# make && make install
-
调整pip的国内源
[[email protected] Python-3.6.5]# vi /etc/pip.conf
[global]
index-url = http://pypi.douban.com/simple
trusted-host= pypi.douban.com
[list]
format=columns -
安装virtualenv(如遇到提示就升级下: /usr/local/python36/bin/pip3 install --upgrade pip)
[[email protected] Python-3.6.5]# /usr/local/python36/bin/pip3 install virtualenv
-
调用virtualenv,在目录下生成python36env配置文件
[[email protected] python36]# /usr/local/python36/bin/virtualenv ./python36env
-
进入python36env环境
[[email protected] python36]# source python36env/bin/activate
-
pip安装pymysql
[[email protected] python36]# pip install pymysql
-
列出目前环境下所有pip安装的包
[[email protected] python36]# pip list
Package Version
pip 19.0.3
PyMySQL 0.9.3
setuptools 40.8.0
wheel 0.33.1
(python36env) - 确保mysql配置文件里是设置过utf8字符集的,否则会有后续问题
[[email protected] python36]# vi /etc/my.cnf
[mysqld]
default-storage-engine =innodb
innodb_file_per_table
collation-server =utf8_general_ci
init-connect =‘SET NAMES utf8‘
character-set-server =utf8
以上是关于Python3.6源码编译安装的主要内容,如果未能解决你的问题,请参考以下文章
python3编译安装no module named _ssl
基于V3S的语音助手python3的编译和安装(该版本解决zlib readline可以使用pip)