博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Numpy, Scipy, and Pandas – Oh My! (Ubuntu 11.10) » Adam Klein's Blog
阅读量:6155 次
发布时间:2019-06-21

本文共 3171 字,大约阅读时间需要 10 分钟。

, , ,
Nov
17
2011

I’ve got a spanking new install of Kubuntu 11.10, and I need to get it set up for Python data hacking.  Sure, I could spring for an , but where would be the masochism in that?

Inspired by , let’s do this the hard way.

The linux distro comes with Python 2.7.2. Perfect! Or, use  to set up a local Python build that you want to use. I presume you know how to get to the command line, as well as how to edit text files using emacs, vim, pico, whatever.

Let’s get some tools:

sudo
apt-get install
git gfortran
g++

We need to compile against Python headers and get setuptools and pip:

sudo
apt-get install python-dev python-pip

Let’s isolate our Python distro from carnage:

sudo
apt-get python-virtualenv
sudo pip
install virtualenvwrapper

Now these lines to your ~/.bashrc:

source
/usr
/local
/bin
/virtualenvwrapper.sh
export
WORKON_HOME=
$HOME
/.virtualenvs

Now open a new terminal and establish a virtual environment, say “py27″:

mkvirtualenv py27
workon py27

We need some math libraries (ATLAS + LAPACK):

sudo
apt-get install libatlas-base-dev liblapack-dev

Ok, now to install and build all the scientific python hotness:

pip
install numpy scipy

For matplotlib, we need lots of libraries. This one is dependency heavy. Note we can ask Ubuntu what we need, what’s installed, and what is not:

apt-cache depends python-matplotlib
|
awk
'/Depends:/{print $2}'
|
xargs
dpkg
--get-selections

Easiest thing to do is just build all the dependencies (just say yes if it asks to install deps of matplotlib instead of python-matplotlib):

sudo
apt-get build-dep python-matplotlib

Ok, now this should work:

pip
install matplotlib

Now, of course, we need the IPython interpreter. Don’t settle for 0.11!

pip
install
-e
git+https:
//github.com
/ipython
/ipython.git
#egg=ipython
cd ~
/.virtualenvs
/py27
/src
/ipython
python setupegg.py
install

Note, you may need to sudo rm /usr/bin/ipython.py if there is a conflict.

Ok, let’s beef up the IPython interpreter. Note the pip commands FAIL. This is ok. We’ll do it by hand.

sudo
apt-get install qt4-dev-tools
pip
install sip
cd ~
/.virtualenvs
/py27
/build
/sip
python configure.py
make
sudo
make
install
pip
install pyqt
cd ~
/.virtualenvs
/py27
/build
/pyqt
python configure.py
make
sudo
make
install
# clean up
cd ~
/.virtualenvs
/py27
/
rm
-rf build

Just a few more things, you won’t be disappointed.

sudo
apt-get install libzmq-dev
pip
install tornado pygments pyzmq

Alright, let’s get . It’s under heavy development ( is a beast); so lets pull the latest from git.

pip
install nose cython
pip
install
-e
git+https:
//github.com
/wesm
/pandas
#egg=pandas
# we should get statsmodels too
pip
install
-e
git+https:
//github.com
/statsmodels
/statsmodels
#egg=statsmodels

Btw, you’ll note this git stuff goes into your ~/.virtualenvs/py27/src directory, if you want to git pull and update.

OK! Phew! For the grand finale:

Run the amazing qtconsole:

ipython qtconsole
--pylab=inline

Or the even more amazing WEB BROWSER:

ipython notebook
--pylab=inline

Launch a browser and point to http://localhost:8888/. For kicks, try opening one of Wes’s tutorial workbooks, . You may have to fiddle a bit, but it should work.

Enjoy!

转载地址:http://kiffa.baihongyu.com/

你可能感兴趣的文章
c#中lock的使用(用于预约超出限额的流程)
查看>>
ODI基于源表时间戳字段获取增量数据
查看>>
并发容器之CopyOnWriteArrayList(转载)
查看>>
什么是AAC音频格式 AAC-LC 和 AAC-HE的区别是什么
查看>>
原创:goldengate从11.2升级到12.1.2
查看>>
Quartz
查看>>
正则表达式的语法规则
查看>>
C#一个关于委托和事件通俗易懂的例子
查看>>
类似于SVN的文档内容差异对比工具winmerge
查看>>
Cause: java.sql.SQLException: The user specified as a definer ('root'@'%') does not exist
查看>>
quratz线程
查看>>
execnet: rapid multi-Python deployment
查看>>
windows修改3389端口
查看>>
关于JavaScript词法
查看>>
FreeSwitch中的会议功能(4)
查看>>
MySQL中创建用户分配权限(到指定数据库或者指定数据库表中)
查看>>
IL指令详细
查看>>
POJ 2406
查看>>
button按钮在IE中的宽度
查看>>
1-17的代码
查看>>