python安装numpy和pandas
2016-11-04 12:12
363 查看
最近要对一系列数据做同比比较,需要用到numpy和pandas来计算,不过使用python安装numpy和pandas因为linux环境没有外网遇到了很多问题就记下来了。首要条件,python版本必须是2.7以上。
linux首先安装依赖包
windows安装pip即可,具体方法参考pip官网 http://pip-cn.readthedocs.io/en/latest/installing.html
1、 pip方式安装
如果有外网一般推荐使用pip安装,linux下和windows下均可使用pip安装
但很快就会发现这些源安装超级慢,所以我推荐大家使用豆瓣的源
2、如果服务器上没有外网使用不了pip,则需要使用源码安装。推荐大家在豆瓣pypi下载,速度更快 https://pypi.doubanio.com/simple/?allow_list_dir=1
python numpy安装包下载地址是 https://pypi.python.org/pypi/numpy/,pandas的安装包下载地址是 https://pypi.python.org/pypi/pandas,github地址是 https://github.com/pandas-dev
如提示缺少 setuptools 则从https://pypi.python.org/pypi/setuptools下载 setuptools安装。
安装pandas会提示 ImportError: Building pandas requires cython则需要安装Cython或者升级Cython先,下载链接 https://pypi.python.org/pypi/Cython/ 。windows下pip安装如下
linux下可使用yum安装或者pip安装
如果需要更新到最新版本的Cython则下载源码后安装
然后是按照pandas
如果遇到需要安装 python-dateutil的提示则是该库版本过低。先下载six最新版本1.9.0(下载地址),然后更新 python-dateutil到新版本2.5.3版本(下载地址)。
最后运行如果出现 /usr/lib64/libstdc++.so.6: ELF file OS ABI invalid的错误则将 /usr/lib64/libstdc++.so.6软链指向低版本的 libstdc++.so.6.0.8,不要指向高版本 libstdc++.so.6.0.20。
至此就安装成功了。
总结,花了一上午安装这个主要是因为下载源慢,依赖包多。所以建议大家都是用pypi豆瓣源,直接在simple下面搜你需要的安装包。
原创文章,转载请备注原文地址 http://www.cnblogs.com/lxmhhy/p/6029465.html
linux首先安装依赖包
yum -y install blas blas-devel lapack-devel lapack yum -y install seaborn scipy yum -y install freetype freetype-devel libpng libpng-devel yum -y install python-pip yum -y install pytz yum -y install python-dateutil
windows安装pip即可,具体方法参考pip官网 http://pip-cn.readthedocs.io/en/latest/installing.html
1、 pip方式安装
如果有外网一般推荐使用pip安装,linux下和windows下均可使用pip安装
python -m pip install --upgrade pip pip install --user numpy scipy matplotlib jupyter pandas sympy nose
但很快就会发现这些源安装超级慢,所以我推荐大家使用豆瓣的源
pip install matplotlib -i http://pypi.douban.com/simple --trusted-host pypi.douban.com pip install numpy -i http://pypi.douban.com/simple --trusted-host pypi.douban.com pip install pandas -i http://pypi.douban.com/simple --trusted-host pypi.douban.com pip install seaborn scipy -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
2、如果服务器上没有外网使用不了pip,则需要使用源码安装。推荐大家在豆瓣pypi下载,速度更快 https://pypi.doubanio.com/simple/?allow_list_dir=1
python numpy安装包下载地址是 https://pypi.python.org/pypi/numpy/,pandas的安装包下载地址是 https://pypi.python.org/pypi/pandas,github地址是 https://github.com/pandas-dev
tar -xzf numpy-1.11.2.tar.gz cd numpy-1.11.2 python setup.py build # 编译几分钟 python setup.py install
如提示缺少 setuptools 则从https://pypi.python.org/pypi/setuptools下载 setuptools安装。
安装pandas会提示 ImportError: Building pandas requires cython则需要安装Cython或者升级Cython先,下载链接 https://pypi.python.org/pypi/Cython/ 。windows下pip安装如下
pip install Cython
linux下可使用yum安装或者pip安装
yum install -y Cython.x86_64
如果需要更新到最新版本的Cython则下载源码后安装
cd Cython-0.25.1 python setup.py build python setup.py install
然后是按照pandas
cd pandas-0.19.0 python setup.py build # 比较久 python setup.py install
如果遇到需要安装 python-dateutil的提示则是该库版本过低。先下载six最新版本1.9.0(下载地址),然后更新 python-dateutil到新版本2.5.3版本(下载地址)。
最后运行如果出现 /usr/lib64/libstdc++.so.6: ELF file OS ABI invalid的错误则将 /usr/lib64/libstdc++.so.6软链指向低版本的 libstdc++.so.6.0.8,不要指向高版本 libstdc++.so.6.0.20。
至此就安装成功了。
总结,花了一上午安装这个主要是因为下载源慢,依赖包多。所以建议大家都是用pypi豆瓣源,直接在simple下面搜你需要的安装包。
原创文章,转载请备注原文地址 http://www.cnblogs.com/lxmhhy/p/6029465.html
相关文章推荐
- 64位操作系统Python2.7安装numpy,matpoltlib,pandas完全教程
- windows下python numpy,scipy,pandas 等模块的安装
- [转] python安装numpy和pandas
- 64位操作系统Python2.7安装numpy,matpoltlib,pandas,scipy
- python安装numpy和pandas
- Python 之 安装 scipy,numpy,matplotlib,pandas
- python3.6中安装numpy,pandas,scipy,scikit_learn,matplotlib等数据分析工具
- 学习Python数据分析(1)----numpy,Pandas,matplotlib,scipy 的安装
- python安装numpy和pandas
- python 如何安装Numpy Scipy pandas等扩展库
- Windos7(32位)安装Python2.7,再加上numpy、scipy、Matplotlib、Ipython、pandas
- linux离线搭建Python环境及安装numpy、pandas
- windows 安装python3.6(numpy,scipy,pandas,matplotlib,scikit-learn)
- linux离线搭建Python环境及安装numpy、pandas
- linux离线搭建Python环境及安装numpy、pandas
- windows 安装python3.6(numpy,scipy,pandas,matplotlib,scikit-learn)
- python3.5下安装numpy,scipy,sklearn,pandas,matplotlib,jieba,requests
- windows 安装python3.6(numpy,scipy,pandas,matplotlib,scikit-learn)
- Python模块简介及安装 [numpy,pandas,matplotlib,scipy,statsmodels,Gensim,sklearn,keras]
- windows 安装python3.6(numpy,scipy,pandas,matplotlib,scikit-learn)