Installing Python 2.7 on Ubuntu
2015-05-18 11:56
246 查看
Installing Python 2.7 on Ubuntu
This week I upgraded the main installation of Python on my Ubuntu 10.04 machines to version 2.7. Here's a short documentation of this process.Step 1: Prerequisites
The first step in Python's installation is running a
configure script which snoops around your system, looking for packages that it needs to build various capabilities and extensions with. Having these packages installed before running
configure makes sure it finds them.
Here are some packages that have to be installed to have various aspects of Python functioning:
sudo apt-get install libreadline-dev sudo apt-get install libsqlite3-dev sudo apt-get install libbz2-dev sudo apt-get install libssl-dev
Step 2: Download and build Python
Go to http://www.python.org/. In the "Quick links" section on the left-hand side of the page, "Source distribution" is a direct link to the tarball. Download it. Unzip the tarball, and from the root of the created directory (which will be called
Python-2.7.2 or something similar, depending on the version):
./configure make -j
I found that the default configure settings work fine for Ubuntu 10.04 and there's no real need to specify extra
--with flags.
You can now check that Python was correctly built by executing
./python and falling into its interactive terminal. If you want, you can also execute the Python test-suite with
make test, though it may take a long time to run (~10 minutes on a relatively fast machine).
Step 3: Install
In the same directory, run:
sudo make install
This installs Python into /usr/local/bin. Depending on the configuration of your system, you may want to add symlinks to the newly created
/usr/local/bin/python2.7 in
/usr/bin/ as well.
That's it, you now have Python 2.7 installed.
Step 4: Install some essential first modules
Python has a powerful packaging & installation machinery for its modules, but it doesn't come pre-installed with Python itself.
So it's a good idea to install
setuptools (or
distribute), followed by
pip.
From now, pip can be used to install other Python modules very conveniently. For example, all you need to have the
IPython shell installed is:
sudo pip install ipython
相关文章推荐
- Installing Python 2.7 on Ubuntu 10.04
- Installing OpenCV on Windows 7 for Python 2.7
- Installing Python 2.7.5 on Ubuntu
- Install OpenCV 3.0 and Python 2.7+ on Ubuntu
- Installing OpenCV for Python on Ubuntu, getting ImportError: No module named cv2.cv
- Installing Selenium and PhantomJS for Python 3 on Ubuntu 14.04
- Installing Python 2.6 on Ubuntu 8.04
- Installing Python 2.7 on Centos 6.5
- Installing python 2.7 on centos 6.3.
- [转]Installing python 2.7 on centos 6.3. Follow this sequence exactly for centos machine only
- Installing OpenCV for Python on Ubuntu, getting ImportError: No module named cv2.cv
- Ubuntu-Python2.7安装 scipy,numpy,matplotlib
- ubuntu python2.7安装MySQLdb
- ubuntu16.0.4 python2.7安装tensorflowGPU版
- Guide of Installing CUDA-7.5 on Ubuntu 14.04
- Install hunspell with python on Ubuntu
- ubuntu(linux)下 python2.7 安装tensorflow 0.12和1.0
- [转]ubuntu10.10升级到11.04过程中python2.7升级出错的解决方法(安装wine过程中出错)
- ubuntu16.04LTS安装tensorflow1.1.0(pip方式/python2.7版本/cpu版本)
- ubuntu16.04,python2.7,opencv3.4.0,安装