欧美三区_成人在线免费观看视频_欧美极品少妇xxxxⅹ免费视频_a级毛片免费播放_鲁一鲁中文字幕久久_亚洲一级特黄

Installing Python 2.6 in CentOS 5 (or RHEL5)

系統(tǒng) 1743 0

CentOS 5 uses python 2.4, and replacing it is not really on option since yum and other core packages depend on it. My solution is to compile 2.6 and use /opt or /usr/local for the prefix. I also create a virtualenv with the new python executable, so when I’m in the environment 2.6 becomes the default python. It also isolates all my python libraries for a given project. Most of this article is actually distribution agnostic, and the yum build requirement install will likely work on other versions of CentOS and other RedHat derivatives like Fedora.

?

Install Build Requirements

Run the following command as root (or with sudo) to install gcc and the development libraries used by python:

      yum install gcc gdbm-devel readline-devel ncurses-devel zlib-devel \
      
bzip2-devel sqlite-devel db4-devel openssl-devel tk-devel bluez-libs-devel

Compile Python

Download and unpack the source tarball for your version of choice. For example:

      VERSION=2.6.1
      
mkdir ~/src
cd ~/src
wget http://python.org/ftp/python/$VERSION/Python-$VERSION.tar.bz2
tar xjf Python-$VERSION.tar.bz2
rm Python-$VERSION.tar.bz2
cd Python-$VERSION
./configure --enable-ipv6 --prefix=/opt
make
sudo make install

Run ./configure –help for more configure options.

If you plan to install multiple versions of python to the same prefix, use “sudo make altinstall” instead of “make install” for the versions you want installed as python2.6 etc, and “make install” for the default version you want installed as simply python. See the README for more details.

After running the make command you will see a list of modules that were not built. If you installed all of the devel libraries listed above, the only missing modules should be bsddb185 and sunaudiodev. You probably don’t need these – bsddb185 is the old version of the berkely db module, and sunaduiodev is for solaris. On x86_64 db and imageop may also be in the list, but looking at the setup.py, it looks like this is normal.

Install setuptools

Download setuptools – get the egg if it’s available for your version of python, otherwise get the tarball. In either case prepend PREFIX/bin to your path, where PREFIX is what you passed to configure when building python (/opt in my example). Then either run the egg as a shell script or unpack the tarball and run “python setup.py install”. Here’s an example for setuptools 0.6c9 and python 2.6:

      wget http://pypi.python.org/packages/2.6/s/setuptools/setuptools-0.6c9-py2.6.egg#md5=ca37b1ff16fa2ede6e19383e7b59245a
      
sudo PATH=/opt/bin:$PATH sh setuptools-0.6c9-py2.6.egg
rm setuptools-0.6c9-py2.6.egg

Install virtualenv and virtualenvwrapper

      sudo /opt/bin/easy_install virtualenv
      
sudo /opt/bin/easy_install virtualenvwrapper

Install More Packages (Optional)

If you plan on using other modules in all your projects, and don’t need different versions, you can install them once in the main site-packages dir for your new python install. Just make sure to use the full path to easy_install (or prepend /opt/bin to the PATH when running eggs or python setup.py), otherwise they will be installed for the system python (2.4 in CentOS 5).

Setup virtualenvwrapper

UPDATED 4-9: Thanks Brian for the feedback. Hopefully this is more clear.

Create a directory to store your virtual environments:

      mkdir ~/.virtualenvs
    

Add the following lines to your bashrc (~/.bashrc):

      export PATH=/opt/bin:$PATH
      
export WORKON_HOME=$HOME/.virtualenvs
source /opt/bin/virtualenvwrapper_bashrc

If you used a prefix other than /opt (e.g. /usr/local) when installing python, then change the PATH line and the source line accordingly. This also assumes you are using bash. I’m not sure how to set up virtualenvwrapper for other shells.

The PATH line will actually make python 2.6 your default interpreter for login sessions. If this is undesirable you may be able to copy virtualenv to some other location already in your path, and it will should still use the appropriate version of python. Be careful if you have virtualenv installed under your main system python – virtual environments created with other version will be tied to that version of python.

New login sessions will automatically source ~/.bashrc and have support for virtualenvwrapper – to update your currently running shell, source it explicitly:

      source ~/.bashrc
    

IMPORTANT: you should use “#!/usr/bin/env python” for your scripts instead of “#!/path/to/python” to make them more portable and work in different virtualenv.

More documentation: virtualenvwrapper , Doug Hellmann’s original virtualenvwrapper article , virtualenv

Create a virtualenv (using virtualenvwrapper)

Choose a name for your new environment. I will use NewEnv as a placeholder. You can create new environments with mkvirtualenv:

mkvirtualenv NewEnv

This command will also automatically activate the new environment. To activate NewEnv in another shell, use the “workon” command:

      workon NewEnv
    

Running workon without any arguments will give you a list of all the virtualenv’s you’ve created. Here are some common packages you may want to easy_install into your new virtualenv. Note that you don’t need to use sudo to install stuff into your virtualenv:

      workon NewEnv
      
easy_install MySQL-python
easy_install twisted
easy_install egenix-mx-base

Install PostgreSQL and psycopg2

Centos 5 has postgres 8.1. To install a 8.3, setup the PostgreSQL yum repository , remove any old versions (but not -libs), and yum install postgresql-devel. Note that you may need to remove nfs-utils to avoid a libevent conflict (or maybe find an updated nfs-utils if you really need it).

      sudo yum erase nfs-utils
      
sudo yum erase postgresql postgresql-devel
sudo rpm -ivh http://yum.pgsqlrpms.org/reporpms/8.3/pgdg-centos-8.3-6.noarch.rpm
sudo yum update
sudo yum install postgresql-devel

workon NewEnv
easy_install psycopg2

Installing Python 2.6 in CentOS 5 (or RHEL5)


更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號(hào)聯(lián)系: 360901061

您的支持是博主寫作最大的動(dòng)力,如果您喜歡我的文章,感覺我的文章對(duì)您有幫助,請(qǐng)用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點(diǎn)擊下面給點(diǎn)支持吧,站長(zhǎng)非常感激您!手機(jī)微信長(zhǎng)按不能支付解決辦法:請(qǐng)將微信支付二維碼保存到相冊(cè),切換到微信,然后點(diǎn)擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對(duì)您有幫助就好】

您的支持是博主寫作最大的動(dòng)力,如果您喜歡我的文章,感覺我的文章對(duì)您有幫助,請(qǐng)用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長(zhǎng)會(huì)非常 感謝您的哦!??!

發(fā)表我的評(píng)論
最新評(píng)論 總共0條評(píng)論
主站蜘蛛池模板: 国产成人精品视频频 | 日本道二区视频 | 色屋视频 | 奇米777影视 | 99综合 | 国产午夜精品在线 | www.热| 91福利免费观看 | 日日摸夜夜爽日日摸视频 | 91看片淫黄大片在看 | 色开心婷婷 | 色综合天天综一个色天天综合网 | 成人午夜爽爽爽免费视频 | 九月激情网 | 九一国产在线观看 | 国产成人免费视频网站视频社区 | 欧美两性人xxxx高清免费 | 国产亚洲欧美在线人成aaaa | 成人av免费在线观看 | 国产精品揄拍100视频最近 | 天天操操| 欧美综合自拍亚洲综合图片区 | 日韩精品欧美高清区 | 欧美一级特黄aaaaaa在线看首页 | 久草在线在线观看 | 国产不卡在线蜜 | 一级特黄特黄毛片欧美的 | 91中文字幕| 91在线播放免费不卡无毒 | 日本动漫三级 | 久视频免费精品6 | 国产aaaaa一级毛片 | 天天舔天天舔 | 免费黄色片网站 | 可以免费观看的av | 亚洲国产成人va在线观看网址 | 国产精品综合视频 | 久久精品一区二区三区四区 | 五月婷婷天堂 | 国产在线精品二区韩国演艺界 | 国产精品视频免费的 |