Python 官方文档:入门教程 => 点击学习
第一个python脚本:[root@backup ~]# cat helloworld.py print("hello world")[root@backup ~]# Python helloworld.py hello world 安装p
第一个python脚本:
[root@backup ~]# cat helloworld.py
print("hello world")
[root@backup ~]# Python helloworld.py
hello world
安装python3及ipython整体环境,非常麻烦,不注意会经常报错,安装不成功,折腾了一天才搞定,流程记录如下:
第一步:安装python3.5
1、Centos6.5 安装Python 的依赖包
yum groupinstall "Development tools"
yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel
2、下载Python3.5的源码包并编译
wget https://www.python.org/ftp/python/3.5.0/Python-3.5.0.tgz
tar xf Python-3.5.0.tgz
cd Python-3.5.0
./configure --prefix=/application/python --enable-shared
make
make install
ln –s /application/python/bin/python3 /usr/bin/python3
3、在运行Python之前需要配置库:
echo /usr/local/lib >> /etc/ld.so.conf.d/local.conf
ldconfig
4、运行演示:
python3 --version
Python 3.5.0
5、删除编译Python时所需要的库,当然也可以不删
yum groupremove "Development tools" --remove-leaveas
yum remove zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel --remove-leaves
6、设置别名方便使用,也可以不用设置
alias py=python3
第二步:安装ipython3
1、需要安装setup-tools
地址:Https://pypi.python.org/pypi/setuptools
解压 unzip setuptools-36.5.0.zip
cd setuptools-36.5.0
/application/python/bin/python3 setup.py install
2、安装pip
地址:https://pypi.python.org/pypi/pip
tar xf pip-9.0.1.tar.gz
cd pip-9.0.1
/application/python/bin/python3 setup.py install
此时会在/application/python/bin下生成一个名为pip pip3 pip3.5的几个文件夹,说明pip模块已经打包进入了python环境。
3、安装python-setuptools和python-setuptools-devel
通过yum install安装即可
4、安装ipython
地址:https://pypi.python.org/pypi/ipython
tar xf ipython-6.0.0.tar.gz
cd ipython-6.0.0
/application/python/bin/python3 setup.py install
5、配置软链接或加入系统环境变量
ln -s /application/python/bin/python3 /usr/bin/python3
ln -s /application/python/bin/ipython3 /usr/bin/ipython3
ln -s /application/python/bin/ipython /usr/bin/ipython
--结束END--
本文标题: python3、ipython3、set
本文链接: https://lsjlt.com/news/192418.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
2024-03-01
2024-03-01
2024-03-01
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0