[英]How to install Python 2.7 on Ubuntu 9.10
Now we're developing our software on the customer side, and there is: 现在,我们正在客户端开发软件,其中包括:
maestro@UIServer:~$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=9.10
DISTRIB_CODENAME=karmic
DISTRIB_DESCRIPTION="Ubuntu 9.10"
system is installed. 系统已安装。 We're not allowed to upgrade this system to a newer version, but we need to use Python 2.7 in our project.
我们不允许将此系统升级到较新版本,但是我们需要在项目中使用Python 2.7。
Eg we have to use pymorphy2 package, but when we're trying to import it into project, we get: 例如,我们必须使用pymorphy2包,但是当我们尝试将其导入项目时,我们得到:
>>> import pymorphy2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/site-packages/pymorphy2/__init__.py", line 3, in <module>
from .analyzer import MorphAnalyzer
File "/usr/local/lib/python2.7/site-packages/pymorphy2/analyzer.py", line 10, in <module>
from pymorphy2 import opencorpora_dict
File "/usr/local/lib/python2.7/site-packages/pymorphy2/opencorpora_dict/__init__.py", line 4, in <module>
from .storage import load_dict as load
File "/usr/local/lib/python2.7/site-packages/pymorphy2/opencorpora_dict/storage.py", line 24, in <module>
from pymorphy2.utils import json_write, json_read
File "/usr/local/lib/python2.7/site-packages/pymorphy2/utils.py", line 5, in <module>
import bz2
ImportError: No module named bz2
Ok, we're trying to install libbz2-dev: 好的,我们正在尝试安装libbz2-dev:
sudo apt-get install libbz2-dev
end getting this: 最终得到这个:
ValueError: /usr/bin/python does not match the python default version. It must be reset to point to python2.6
dpkg: error processing python-pip (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
python-pip
E: Sub-process /usr/bin/dpkg returned an error code (1)
How to avoid this problem? 如何避免这个问题?
Thanks in advance! 提前致谢!
Download python , build and install using : 下载python ,使用以下命令构建和安装:
$ ./configure
$ make
$ make install
I am assuming you have build-essential
installed or at least gcc
. 我假设您已经安装了
build-essential
或至少安装了gcc
。 You can customize installation by passing prefix=/path/where/you/want/python/installed
and other flags to make
. 你可以通过自定义安装
prefix=/path/where/you/want/python/installed
和其他标志来make
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.