2

我正在尝试将我们的应用程序升级到 Python 3,但无法让 conda 接受该包兼容。

该包似乎可以构建,并且似乎是一个 Python 3 包:

 λ conda search jbagdal --info

jbagdal 2.2.0 py36_vc15hca0d6c3_0
---------------------------------
file name   : jbagdal-2.2.0-py36_vc15hca0d6c3_0.tar.bz2
name        : jbagdal
version     : 2.2.0
build       : py36_vc15hca0d6c3_0
build number: 0
size        : 8.7 MB
subdir      : win-64
url         : file://devserver/conda_packages/win-64/jbagdal-2.2.0-py36_vc15hca0d6c3_0.tar.bz2
md5         : 600a8...770e9
timestamp   : 2019-07-02 14:42:03 UTC
dependencies:
  - geos
  - numpy
  - proj4
  - python >=3.6,<3.7.0a0
  - sqlite

但是,当我使用 Python 3.6.8 创建一个全新的 conda 环境并尝试安装包时,我收到一条消息,即许多依赖项将降级到 Python 2.7。

λ conda install jbagdal

The following packages will be DOWNGRADED:

  certifi                                  2019.6.16-py36_0 --> 2019.6.16-py27_0
  pip                                         19.1.1-py36_0 --> 19.1.1-py27_0
  python                                   3.6.8-h9f7ef89_7 --> 2.7.15-h2880e7c_4
  setuptools                                  41.0.1-py36_0 --> 41.0.1-py27_0
  vc                                        14.1-h0510ff6_4 --> 9-h7299396_1
  wheel                                       0.33.4-py36_0 --> 0.33.4-py27_0
  wincertstore                           0.2-py36h7fe50ca_0 --> 0.2-py27hf04cefb_0

我已经查过了,有些人建议明确指定 Python 版本,但这也不起作用。

 λ conda install jbagdal python==3.6.8
Collecting package metadata: done
Solving environment: failed

UnsatisfiableError: The following specifications were found to be in conflict:
  - jbagdal
  - python==3.6.8
Use "conda search <package> --info" to see the dependencies for each package.

我的包裹有什么问题?为什么 conda 不相信它是 Python 3 包?我需要在配方中进行哪些更改才能将其构建为 Python 3。

元.yaml

package:
  name: jbagdal
  version: 2.2.0

source:
  git_rev: trunk
  git_url: https://srcserver/GDAL/gdal.git

build:
  features:
    - vc9     [win and py27]
    - vc10    [win and py34]
    - vc14    [win and py35]
    - vc15    [win and py>=36]

requirements:
  build:
    - swig
    - sqlite
    - python
    - numpy
    - setuptools
    - {{ compiler('c') }}
    - {{ compiler('cxx') }}

  run:
    - python
    - sqlite
    - numpy
    - geos
    - proj4

about:
  home: www.gdal.org
  license:
  license_file:

conda信息的输出

     active environment : deleteme
    active env location : C:\ProgramData\Anaconda2\envs\deleteme
            shell level : 1
       user config file : C:\Users\jontwo\.condarc
 populated config files : C:\Users\jontwo\.condarc
          conda version : 4.6.8
    conda-build version : 3.0.15
         python version : 2.7.15.final.0
       base environment : C:\ProgramData\Anaconda2  (writable)
           channel URLs : file://devserver/conda_packages/win-64
                          file://devserver/conda_packages/noarch
                          https://conda.anaconda.org/scitools/win-64
                          https://conda.anaconda.org/scitools/noarch
                          https://repo.anaconda.com/pkgs/main/win-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/free/win-64
                          https://repo.anaconda.com/pkgs/free/noarch
                          https://repo.anaconda.com/pkgs/r/win-64
                          https://repo.anaconda.com/pkgs/r/noarch
                          https://repo.anaconda.com/pkgs/msys2/win-64
                          https://repo.anaconda.com/pkgs/msys2/noarch
          package cache : C:\ProgramData\Anaconda2\pkgs
                          C:\Users\jontwo\.conda\pkgs
                          C:\Users\jontwo\AppData\Local\conda\conda\pkgs
       envs directories : C:\ProgramData\Anaconda2\envs
                          C:\Users\jontwo\.conda\envs
                          C:\Users\jontwo\AppData\Local\conda\conda\envs
               platform : win-64
             user-agent : conda/4.6.8 requests/2.21.0 CPython/2.7.15 Windows/10 Windows/10.0.17134
          administrator : False
             netrc file : None
           offline mode : False

Conda build 命令确实指定了 Python 版本:

conda build . --output-folder v:\conda_packages --python=3.6.8

而当前的 conda 环境是 Python 3.6.8:

 λ python --version
Python 3.6.8 :: Anaconda, Inc.
4

1 回答 1

0

答案是meta.yaml不正确的。

    - vc14    [win and py35]
    - vc15    [win and py>=36]

应该

    - vc14    [win and py>=35]

[track_features]错误是因为在安装之前在本地计算机上conda查找。vc15一旦我将其改回vc14,一切正常。

于 2019-07-05T11:11:48.340 回答