在/ tmp / pip-build-FM0q5o / pandas /中的ubuntu错误代码1上安装pandas

时间:2016-05-16 05:19:32

标签: python ubuntu numpy pandas

我试图在ubuntu中安装pandas但是有问题 我已经安装了numpy并去了pandas

  

kcn @ vaio:〜$ sudo pip install pandas

The directory '/home/kcn/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/kcn/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting pandas
/usr/local/lib/python2.7/dist-packages/pip-8.1.1-py2.7.egg/pip/_vendor/requests/packages/urllib3/util/ssl_.py:315: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. For more information, see "https//urllib3.readthedocs.org/en/latest"/security.html#snimissingwarning.
  SNIMissingWarning
/usr/local/lib/python2.7/dist-packages/pip-8.1.1-py2.7.egg/pip/_vendor/requests/packages/urllib3/util/ssl_.py:120: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
  Downloading pandas-0.18.1.tar.gz (7.3MB)
    100% |████████████████████████████████| 7.3MB 97kB/s 
Requirement already satisfied (use --upgrade to upgrade): python-dateutil in /usr/local/lib/python2.7/dist-packages (from pandas)
Requirement already satisfied (use --upgrade to upgrade): pytz>=2011k in /usr/local/lib/python2.7/dist-packages (from pandas)
Requirement already satisfied (use --upgrade to upgrade): numpy>=1.7.0 in /usr/local/lib/python2.7/dist-packages (from pandas)
Requirement already satisfied (use --upgrade to upgrade): six>=1.5 in /usr/lib/python2.7/dist-packages (from python-dateutil->pandas)
Installing collected packages: pandas
  Running setup.py install for pandas.../   #it took 20 min then.. 
 error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

    ----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-qXBFie/pandas/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-icD0t5-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-qXBFie/pandas/
/usr/local/lib/python2.7/dist-packages/pip-8.1.1-py2.7.egg/pip/_vendor/requests/packages/urllib3/util/ssl_.py:120: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning

3 个答案:

答案 0 :(得分:3)

我自己得到了这个答案 实际上在Ubuntu中已经安装了两个版本的Python 所以当pip安装时我们必须这样做 首先确认你正在使用哪个python python -version 然后通过这样确保你想要的python版本: 3的 alias python = python3 或2的别名python = python2 和 它意味着你有2个点版本,即python版本2 pip3为python版本3的pip。 如果你想为python 2.7安装pandas,你只需要 sudo pip安装pandas
如果你想为python 3安装pandas,你只需要 sudo pip3安装pandas
安装pandas之后如果你想在2.7中编译你的程序,那你就是这样做了 alias python = python2 ,反之亦然 检查终端中的版本是否写入>>> python
https://askubuntu.com/questions/320996/make-default-python-command-to-use-python-3这个答案提供了有关此问题的更多信息。

答案 1 :(得分:1)

最好不要搞乱系统python。请改用pip install pandas --user。或者使用virtualenv。

答案 2 :(得分:0)

可以尝试一下。当您没有安装Python开发工具时会发生这种情况,因此无论您是使用v2.7还是3,都无法编译软件包。

sudo apt-get install python-dev