无法为python 2.7.12安装scikit-image

时间:2019-05-22 05:43:34

标签: python ubuntu scikit-image

我无法为python 2.7.12安装scikit-image

我第一次尝试安装scikit-image是通过运行以下命令:

$ pip install -U scikit-image

但是,我收到一条错误消息:

  

对于Python 2.7,请使用以下命令安装0.14.x长期支持:   $ pip安装'scikit-image <0.15'

我运行了上面的命令,但是对python 3.5有依赖性:

$ pip install 'scikit-image<0.15'

  

收集scikit-image <0.15     使用缓存的https://files.pythonhosted.org/packages/6a/04/f726af6b2e39a4dad0e5502670c4b33d5c915880a54a98aeb33b95150531/scikit_image-0.14.2-cp27-cp27mu-manylinux1_x86_64.whl   收集cloudpickle> = 0.2.1(来自scikit-image <0.15)     使用缓存的https://files.pythonhosted.org/packages/24/fb/4f92f8c0f40a0d728b4f3d5ec5ff84353e705d8ff5e3e447620ea98b06bd/cloudpickle-1.1.1-py2.py3-none-any.whl   收集枕头> = 4.3.0(来自scikit-image <0.15)     使用缓存的https://files.pythonhosted.org/packages/b6/4b/5adc1109908266554fb978154c797c7d71aba43dd15508d8c1565648f6bc/Pillow-6.0.0-cp27-cp27mu-manylinux1_x86_64.whl   收集scipy> = 0.17.0(来自scikit-image <0.15)     使用缓存的https://files.pythonhosted.org/packages/cb/97/361c8c6ceb3eb765371a702ea873ff2fe112fa40073e7d2b8199db8eb56e/scipy-1.3.0.tar.gz       来自命令python setup.py egg_info的完整输出:       追溯(最近一次通话):         文件“”,第1行,位于         在第31行的“ /tmp/pip-build-qQaiTX/scipy/setup.py”文件中           引发RuntimeError(“需要的Python版本> = 3.5。”)       RuntimeError:Python版本> = 3.5必需。

使用python 2.7安装scikit-image是否必须安装<0.15 ...版本,但该版本需要python 3.5才有意义吗?

5 个答案:

答案 0 :(得分:0)

尝试一下:

pip install scikit-image==0.14.1 

答案 1 :(得分:0)

Scikit-image 0.15.0的最新版本Python 2不存在。

有关支持Python 2的某些较旧版本,请参见软件包的pypi repository。另外,请检查您是否使用了正确的pip

答案 2 :(得分:0)

如果同一台计算机上有两个Python版本,则应明确指定pip版本:

#include <stdio.h> 
#include <stdlib.h>

int main(void) {

    int count,          /* integer amount from user     */
        odd_count = 0,  /* odd count (initialized zero) */
        even_count = 0, /* even count (initialized zero)*/
        *number,        /* declare pointers             */
        *evens,
        *odds; 

    /* read in integer count from user (VALIDATE every input) */
    printf("enter the amount of numbers: ");
    if (scanf("%d", &count) != 1) {
        fputs ("error: invalid integer input.\n", stderr);
        return 1;
    }

    /* allocate count integers each pointer (VALIDATE every allocation) */
    if ((number = malloc (count * sizeof *number)) == NULL) {
        perror ("malloc-number");
        return 1;
    }
    if ((evens = malloc (count * sizeof *evens)) == NULL) {
        perror ("malloc-evens");
        return 1;
    }
    if ((odds = malloc (count * sizeof *odds)) == NULL) {
        perror ("malloc-odds");
        return 1;
    }

    for (int i = 0; i < count; i++) {   /* loop count times for input */
        printf ("enter number %2d: ", i + 1);
        if (scanf ("%d", &number[i]) != 1) {    /* validate EVERY input */
            fputs ("error: invalid integer input.\n", stderr);
            return 1;
        }
        if (number[i] % 2 == 0)     /* assign, increment evens count */
            evens[even_count++] = number[i];
        else                        /* same for odds */
            odds[odd_count++] = number[i];
    }

    puts ("\n numbers\n--------");      /* output each array on its own */
    for (int i = 0; i < count; i++)
        printf ("%8d\n", number[i]);

    puts ("\n   evens\n--------");
    for (int i = 0; i < even_count; i++)
        printf ("%8d\n", evens[i]);

    puts ("\n    odds\n--------");
    for (int i = 0; i < odd_count; i++)
        printf ("%8d\n", odds[i]);

    /* output all arrays together */
    puts ("\nnumbers      even      odd\n-------- -------- --------");
    for (int i = 0; i < count; i++) {       /* loop printing number */
        printf ("%8d", number[i]);
        if (i < even_count) {               /* if i < even_count */
            printf (" %8d", evens[i]);      /* output evens */
            if (i < odd_count)              /* if odds too, output them */
                printf (" %8d\n", odds[i]);
            else
                putchar ('\n');             /* no more odds output '\n' */
        }
        else if (i < odd_count)             /* if only odds left, output */
            printf ("%18d\n", odds[i]);
        else
            putchar ('\n');
    }

    free (number);  /* don't forget to free what you allocated */
    free (evens);
    free (odds);
}

为我工作的是2.7.15

答案 3 :(得分:0)

提示出在您的错误消息中:

Collecting scipy>=0.17.0 (from scikit-image<0.15)
Using cached https://files.pythonhosted.org/packages/cb/97/361c8c6ceb3eb765371a702ea873ff2fe112fa40073e7d2b8199db8eb56e/scipy-1.3.0.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "", line 1, in
File "/tmp/pip-build-qQaiTX/scipy/setup.py", line 31, in
raise RuntimeError("Python version >= 3.5 required.")
RuntimeError: Python version >= 3.5 required.

您获得了正确的scikit映像(0.14.2),但是现在SciPy收到的更新也与2.7不兼容,因此它本身会引发错误(请参见文件{{1}中的引发) }。)因此,您应该尝试.../scipy/setup.py

随着越来越多的软件包仅成为Py3.5 +,您可能需要再执行几个周期。

答案 4 :(得分:0)

最合适:python2.7 -m pip install scipy==1.2.3

然后:python2.7 -m pip install PyWavelets==1.0.3

然后:python2.7 -m pip install scikit-image==0.14.5