Skip to content

Instantly share code, notes, and snippets.

@den-run-ai
Forked from fyears/note.md
Last active September 7, 2015 04:45
Show Gist options
  • Save den-run-ai/4fd8852f8c49823f4e8e to your computer and use it in GitHub Desktop.
Save den-run-ai/4fd8852f8c49823f4e8e to your computer and use it in GitHub Desktop.
how to install scipy numpy matplotlib ipython in virtualenv

if you are using linux, unix, os x:

pip install -U setuptools
pip install -U pip

pip install numpy
pip install scipy
pip install matplotlib
#pip install PySide
pip install ipython[all]
pip install patsy
pip install pandas
pip install sympy
pip install nose

pip install statsmodels
pip install zipline
pip install quandl
pip install scikit-learn
pip install pillow
ipython profile create
ipython qtconsole --matplotlib inline
# ipython
# ipython notebook

If you are using OS X, you should do this first:

brew install python
brew tap homebrew/science
brew install gfortran
brew install pkg-config freetype libpng
brew install pyside # yeah i know...
ln -s /usr/local/include/freetype2 /usr/local/include/freetype
pip install -U setuptools
pip install -U pip
pip install -U virtualenv
virtualenv ~/.venv
source ~/.venv/bin/activate

# importantly, copy the files of pyside and shiboken into .venv
# so that you can use pyside in virtualenv

# pip install anything except pyside

change the font size of ipython qtconsole

go to ~/.ipython/profile_default/ipython_qtconsole_config.py and modify the you-know-it line to c.IPythonWidget.font_size = 14

startup

the best practise of starting:

ipython qtconsole --matplotlib inline

mirror

set up the mirror (linux and osx):

nano ~/.pip/pip.conf
[global]
index-url = http://pypi.mirrors.ustc.edu.cn/simple

To avoid any troubles, install visual studio 2008 if you are using py2.7 or visual studio 2010 if you are using py3. Express edition is enough. Another way is to install Microsoft Visual C++ Compiler for Python 2.7 if you are using Python 2.7.

Go to the following address to download the complied packages:

http://www.lfd.uci.edu/~gohlke/pythonlibs/

numpy-MKL
scipy

and place the .exe file in home directory.

Run the following command in cmd:

(you should adjust the file names)

virtualenv venv
venv\Scripts\activate.bat
pip install -U setuptools
pip install -U pip

easy_install numpy-MKL.exe
easy_install scipy.exe
pip install matplotlib
pip install PySide
pip install ipython[all]
pip install patsy
pip install pandas
pip install sympy
pip install nose

# others
pip install statsmodels
pip install zipline
pip install quandl
pip install scikit-learn

# create the profile of ipython
ipython profile create

Installation finished.

Next every time want to use the stack, type following in cmd:

venv\Scripts\activate.bat
ipython qtconsole --matplotlib inline
# ipython
# ipython notebook

Here you go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment