Installation problems with Healpy python-3..4 on ubuntu-14.04

旧城冷巷雨未停 提交于 2020-01-04 02:34:34

问题


I am new to ubuntu and using ubuntu 14.04 on lenovo t410 with python-3.4 For installing Healpy I have followed following steps; I have installed pthon3-dev package using

    sudo apt-get install python3-dev

and python-vm-builder by:

    sudo apt-get install python-vm-builder

But when I install Healpy using the command:

    pip install healpy

it gives me following error:

error: command 'i686-linux-gnu-gcc' failed with exit status 1

error code 1 in /tmp/pip_build_sibte/healpy
    Traceback (most recent call last):
File "/usr/bin/pip", line 9, in <module>
load_entry_point('pip==1.5.4', 'console_scripts', 'pip')()
File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 185, in main
return command.main(cmd_args)
File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 161, in main
text = '\n'.join(complete_log)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 27: ordinal not in range(128)

Any help to solve the problem?


回答1:


In Ubuntu 14.10 and later, python3-healpy can be installed from the default Ubuntu repositories. Open the terminal and type:

sudo apt install python3-healpy

I have successfully installed healpy in Ubuntu 14.04 by downloading the python3-healpy package for Ubuntu 14.10 16.04 because the python3-healpy package is not available in Ubuntu 14.04. I installed python3-healpy in Ubuntu 14.04 using the following steps:

  1. Download dependencues of healpy. From http://packages.ubuntu.com/xenial/libcfitsio2 choose your architecture, select your mirror, and download libcfitsio2. From http://packages.ubuntu.com/xenial/libhealpix-cxx0v5 choose your architecture, select your mirror, and download libhealpix-cxx0v5.

  2. Download healpy. From http://packages.ubuntu.com/xenial/python3-healpy choose your architecture, select your mirror, and download python3-healpy

  3. Install dependencies. From the terminal run:

    sudo apt install libgomp1 python3-numpy python3-pyfits python3-six python3-matplotlib idle3 
    

    If any of these packages are already installed, the terminal will give you a message about which packages are already installed and install only the other packages.

  4. Install libcfitsio2. Browse to the folder where you downloaded the libcfitsio2_3.370-5 .deb file, double-click it to open it for installation in the Ubuntu Software Center, and install it.

  5. Install libhealpix-cxx0v5. Browse to the folder where you downloaded the libhealpix-cxx0_3.11.2-7.1 .deb file, double-click it to open it for installation in the Ubuntu Software Center, and install it.

  6. Install python-healpy_1.8.1-1.1. Browse to the folder where you downloaded the python-healpy_1.8.1-1.1 .deb file, double-click it to open it for installation in the Ubuntu Software Center, and install it.

  7. Test python3-healpy. Open IDLE3 and test python3-healpy by running the following simple Python code:

    import healpy as hp
    hp.pix2ang(16, 1440)
    

    This code should return the following output:

    (1.5291175943723188, 0.0)
    



回答2:


As you can see from the traceback, /usr/bin/pip is using Python 2. Run

sudo apt-get install python3-pip

to install a /usr/bin/pip3 binary, then try running

sudo pip3 install healpy

and see if that gets you anywhere. Make sure you have python3-matplotlib and python3-numpy installed as well, as in my experience it's much easier (and faster) to install them through the package manager than through pip.



来源:https://stackoverflow.com/questions/25256019/installation-problems-with-healpy-python-3-4-on-ubuntu-14-04

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!