我正在尝试将我们的应用程序升级到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。
meta.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.
答案 0 :(得分:0)
答案是meta.yaml
不正确。
- vc14 [win and py35]
- vc15 [win and py>=36]
应该是
- vc14 [win and py>=35]
[track_features]
错误是因为conda
在安装之前在本地计算机上寻找vc15
。一旦将其更改回vc14
,一切正常。