源码安装
1.下载 Python-3.6.5.tgz
2.安装必要软件包(不然可能像pip的命令无法使用)
apt-get install -y build-essential libncursesw5-dev libreadline6-dev libssl-dev libgdbm-dev libc6-dev libsqlite3-dev tk-dev bzip2 libbz2-dev
3.解压后进入源码目录配置并make
./configure --prefix=/root/python-3.6.5(表示我们希望将python安装到/root下,此时在/root/python-3.6.5下生成的是python的.a库)
./configure --prefix=/root/python-3.6.5 --enable-shared CFLAGS=-fPIC (如果使能了动态库,则系统会调用动态python的.so(此时就会不生成.a库了, 好处是便于其他组件比如caffe开发python接口),我们还需要在~/.bashrc 下
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/root/python-3.6.5/lib)
make
make install
将python添加到环境path
vim ~/.bashrc 将 /root/python-3.6.5/bin 添加到 PATH
4.官方文档
https://docs.python.org/3/library/index.html
5.其他一些库
1.python图像处理包PIL
安装:#pip3.6 install pillow.
深入学习:
官网 http://pillow.readthedocs.org/en/latest/handbook/tutorial.html
翻译 https://www.cnblogs.com/apexchu/p/4231041.html
2.python3中关于mysql关系型数据库的组件为 PyMySQL(mysql官方也提供了一个 mysql.connector 也是可以用的,他们都是mysql的客户端)。mysqldb为python2所支持的版本,python3中已经废弃。
安装:
#pip3.6 install PyMySQL
#apt-get install mysql-server-5.6 (安装过程中我的密码即 enter)
mysql.connector 安装:
#git clone https://github.com/mysql/mysql-connector-python.git
#pip3.6 setup.py install
深入学习:
http://www.runoob.com/python3/python3-mysql.html
https://pymysql.readthedocs.io/en/latest/ 这是官网,api reference里面有很多内容
3.安装numpy
pip3.6 install numpy
深入学习numpy
https://docs.scipy.org/doc/numpy/user/quickstart.html
4.安装matplot
pip3.6 install matplotlib