在bluehost上安装pytoh 2.7.2
第一步,当然是先连接到shell上,先在cpanel的ssh/shell上启动shh.
我是用mac连的,打开terminal ,敲入:ssh 你在bluehost用户名@你的域名,然后再输入密码,就可以链接了。
==以下是网上搜下来的安装步骤。
After I discovered the presence of Python 2.6 on BlueHost, they decided to remove this installation by default. Fortunately it’s really simple to build Python from sources and install it (and naturally, the good thing is that all required packages to build Python are installed on BlueHost servers).
So here the steps to follow to build and install the python version you prefer (tested with Python 2.6 and 2.7.x).
1 2 | wget http: //www .python.org /ftp/python/2 .7.2 /Python-2 .7.2.tgz tar xzvf Python-2.7.2.tgz |
and, just a note, the package is well done and it will create a Python subfolder
After this we can already configure and install it.
1 2 3 4 | cd Python -2.7 . 2 . / configure - prefix = / home 2 / mornatin / python 272 --enable-unicode=ucs4 make make install |
Change the Python version in this example and the installation directory with what you prefer. Naturally, considering you are on shared host (if you have a dedicated server you can install python using your distribution package system), you have access only to your home folder, so the target directory must be inside your home.
If all worked well, at the end of this procedure your python is correctly install in your system and you can start using it. To test you can just simply try to start the binary file
1 | /home2/mornatin/python272/bin/python |
A thing I can suggest, if you don’t want to override the BlueHost default python and/or if you want to install different python version, is to rename the python binary with something different. For example:
1 | mv /home2/mornatin/python272/bin/python /home2/mornatin/python272/bin/python27 |
After this step you can add the python bin folder to your PATH and use it everywhere:
1 | export PATH= /home2/mornatin/python272/bin :$PATH |
All configured and you can start working with your new python version. An important thing to remember is that, if you haven’t python 2.7 (or other) configured as default python, when you want to install a new module in it, you should invoke the correctly binary file. Following this installation example:
1 | python27 setup.py install |