install python262 - 海阔V天空的个人空间 - 开源中国社区
install python262
#######################install python_2.6.2
./configure --prefix=/usr/local/python262
make
make install
mv /usr/local/bin/python /usr/local/bin/python.bak
ln -s /usr/local/python262/bin/python /usr/local/bin/python########################install easy_install
wget http://peak.telecommunity.com/dist/ez_setup.py
python ez_setup.py执行两次
会自动根据本机的py版本选择对应的egg
安装时提示找不到zlib
安装zlib
yast -i zlib
wget ftp://mirror.switch.ch/pool/1/mirror/scientificlinux/5rolling/x86_64/SL/zlib-devel-1.2.3-3.x86_64.rpm
yast -i zlib-devel-1.2.3-3.x86_64.rpm
再重新 python ez_setup.py
设置环境变量
vim /etc/profile
export PATH=/usr/local/python262/bin:$PATH
source /etc/profile
安装完可以看到有/usr/bin/easy_install程序了
###########################################
easy_install MySQL-python
import MySQLdb
报错:
ImportError: libmysqlclient_r.so.16: cannot open shared object file: No such file or directory
1.确定libmysqlclient_r.so.16的位置
/usr/local/mysql/lib/mysql/libmysqlclient_r.so.16 -> libmysqlclient_r.so.16.0.0
2.确定libmysqlclient_r.so.16使用的函数库及其位置
ldd /usr/local/mysql/lib/mysql/libmysqlclient_r.so.16
/usr/local/mysql/lib/mysql/libmysqlclient_r.so.16.0.0
ldd -v /usr/local/mysql/lib/mysql/libmysqlclient_r.so.16
/lib64
3.拷贝函数库到需要位置
cp -af /usr/local/mysql/lib/mysql/libmysqlclient_r.so.16.0.0 /lib64 或者 vim /etc/ld.so.conf将/usr/local/mysql/lib/mysql该目录添加到第一行
4.ldconfig
5.ldconfig -v | grep libmysqlclient_r.so.16
import MySQLdb sucess!!!!
############################################
EnvironmentError: mysql_config not found
reason: can not find this file /usr/local/mysql/bin/mysql_config
solution:
vim /etc/profile
export PATH=/usr/local/mysql/bin/:$PATH
. /etc/profile
#####################################
#######miss module
Late last year, I set out to get some python apps running on my dreamhost account, previously I maintained this stuff on an ec2 ubuntu instance, so I could do whatever I wanted there. But ec2 is expensive and dreamhost is cheap, so I made the move.
Update May 15, 2010: Thanks to Tommaso Lanza, who, has written a shell script to automate this installation, which now includes mercurial, he has also left a few notes in the comments. Use at your own risk!.
Python
I thought all I would need to do is compile Python and get virtualenv running, but there was a little more to it, because as soon as I compiled Python I received the following warning:
This doesn’t mean it didn’t compile, but it means those modules were not compiled in. I really wanted readline, and thought it would be a good idea to have bz2. I didn’t expect I’d need _tkinter, but who knows and I wasn’t sure when and where I might need berkeley db (_bsddb, note: you’ll need a 4.5 version of Berkeley DB if you want support). So I set out to compile these modules in. I wasn’t worried about needing sunaudiodev or bsddb185, they’re both very old.
Without documenting my errors along the way, here is how I installed Python 2.6.4 on dreamhost:
First give yourself a place to install the necessary packages, and then a place to compile them. You can name them whatever you want, I used
$HOME/opt
to install and$HOME/tmp
to compile in. Dreamhost recommends$HOME/run
to install and$HOME/soft
to compile in. Do whatever your comfortable with.Grab everything you’ll need and put that in tmp:
Setup your environment:
Setting all these environment variables may not be necessary it’s what I had at the end of compiling, Python looks at
LDFLAGS
andCPPFLAGS
, the others are pretty standard compile env variables.Update: Thanks to Christian, who, in the comments, provided additional instructions to grab and install SSL support, if you think you’ll need SSL, here are the steps:
Compile and Install
When you ran make on Python-2.6.4, the only warning should now be:
As I mentioned above, I don’t think I’ll ever need these 2 modules, if i ever do, I’ll worry about it then.
Next I updated my PATH to include the new binaries
virtualenv and virtualenvwrapper
And finally I installed virtualenv and virtualenvwrapper along with some things in my .bashrc to make life easier.
And there you have it, a Python 2.6.4/virtualenv environment setup on dreamhost to do whatever you wa