CentOS 6.6源码安装Python 2.7
来源:互联网 发布:胸大 知乎 编辑:程序博客网 时间:2024/06/06 08:50
源码安装Python 2.7.3
操作步骤如下:
- 安装devtoolset
yum groupinstall "Development tools
- 安装编译Python需要的包包
yum install zlib-develyum install bzip2-develyum install openssl-develyum install ncurses-develyum install sqlite-devel
- 下载并解压Python 2.7.3的源代码(根据自己的项目的需要安装昂对应的版本)
cd /optwget --no-check-certificate https://www.python.org/ftp/python/2.7.3/Python-2.7.3.tar.xztar xf Python-2.7.3.tar.xzcd Python-2.7.9
- 编译与安装Python 2.7.9
./configure --prefix=/usr/localmake && make altinstall (两个同事安装的)
- 将python命令指向Python 2.7.3 这样做就是把在命令行中输入Python的时候 启动的是Python2.7.3
ln -s /usr/local/bin/python2.7 /usr/local/bin/python
- 检测Python 版本
shsh-4.1# python -VPython 2.7.9
最后重新启动服务就可以了
- 接下来开始安装配置 setuptools
# wget https://pypi.python.org/packages/source/d/distribute/distribute-0.6.27.tar.gz# tar xf distribute-0.6.27.tar.gz# cd distribute-0.6.27# python2.7 setup.py install
安装成功后会在/usr/local/bin 下面出现easy_install-2.7
- 安装pip
- 源码安装pip
wget https://pypi.python.org/packages/source/p/pip/pip-1.3.1.tar.gz --no-check-certificatecp pip-1.3.1.tar.gz /usr/src/tar zxvf pip-1.3.1.tar.gzcd pip-1.3.1python setup.py installln -s /usr/local/python2.7/bin/pip /usr/bin/pip
安装成功后, 就可以使用pip 来安装需要的Python 包了
使用pip安装Python-mysql的时候
需要先安装完mysql 安装完mysql 后, 产生后一些配置文件后才能安装 Python-mysql当遇到缺少 出现缺少 my.h my_config.h 等文件没有的话就需要安装 yum install mysql-devel 和 yum install Python-devel
安装 pip install MySQL-python
- 安装问题1
InsecurePlatformWarningUsing cached MySQL-python-1.2.5.zipComplete output from command python setup.py egg_info:sh: mysql_config: command not foundTraceback (most recent call last): File "<string>", line 1, in <module> File "/tmp/pip-build-9tafB8/MySQL-python/setup.py", line 17, in <module> metadata, options = get_config() File "setup_posix.py", line 43, in get_config libs = mysql_config("libs_r") File "setup_posix.py", line 25, in mysql_config raise EnvironmentError("%s not found" % (mysql_config.path,))EnvironmentError: mysql_config not found解决方法: 从别的系统上拷贝来一个 mysql_config 然后更改权限 731
- 安装问题2 缺少 my.h my_config.h等文件时:
error: command 'gcc' failed with exit status 1出现缺少 my.h my_config.h 等文件没有的话 就是少安装了yum install mysql-develyum install Python-devel
pip install python-ldap遇到的问题
- 缺少各种ldap.h文件的时候也是需要安装 yum install ldap-devel
阅读全文
0 0
- CentOS 6.6源码安装Python 2.7
- CentOS上从源码安装python
- Centos 7下源码安装python 3.6
- centos安装 python 2.7
- CentOS 6.6 安装Python 2.7.8
- CentOS 6.6 源码安装MySQL
- CENTOS 安装 Python 2.7 总结
- Centos 6.4 安装Python 2.7 python-pip
- Centos 6.4 安装Python 2.7 python-pip
- Centos 6.4 安装Python 2.7 python-pip
- CentOS源码安装PHP
- centos 源码安装lamp
- CentOS 源码安装PHP
- Centos 源码安装 nginx
- centos源码安装tomcat
- centos源码安装subversion
- centos源码安装PHP
- centos源码安装nginx
- 使用 GROUP BY 的 WITH ROLLUP
- Java中关于定时自动任务的实现
- RTLAB异步通信---客户端代码
- golang进阶(七)——go语言的几种测试方法
- unity开发: socket网络连接
- CentOS 6.6源码安装Python 2.7
- 快速上手友盟推送前后端
- 会声会影的多点运动追踪你会用么
- 实在没想到系列——HashMap实现底层细节之keySet,values,entrySet的一个底层实现细节
- android StrictMode(严苛模式)详解
- 9.Python的基本运算和表达式(上)
- log4j的详细使用
- might_sleep 分析
- Thread类中join()方法