首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Opencv 2.4.13需要python 2.7,但单目总捕获存储库需要python 3.5

Opencv 2.4.13需要python 2.7,但单目总捕获存储库需要python 3.5
EN

Stack Overflow用户
提问于 2020-03-11 22:00:44
回答 2查看 137关注 0票数 0

我正在尝试使用这个repo:

https://github.com/CMU-Perceptual-Computing-Lab/MonocularTotalCapture

它需要"OpenCV 2.4.13 (使用CUDA9.0,CUDNN7.0从源代码编译而来)“,所以我尝试使用conda安装它。在我的系统中,默认的python安装是:

代码语言:javascript
运行
复制
(base) root@ziom-Z87-HD3:/home/ziom# python
Python 2.7.16 |Anaconda, Inc.| (default, Sep 24 2019, 21:51:30) 
[GCC 7.3.0] on linux2

但是repo需要python 3.5,因此我使用以下命令切换到它:

代码语言:javascript
运行
复制
alias python='/usr/bin/python3.5'

看起来它起作用了。

代码语言:javascript
运行
复制
(base) root@ziom-Z87-HD3:/home/ziom# python
Python 3.5.2 (default, Oct  8 2019, 13:06:37) 
[GCC 5.4.0 20160609] on linux

现在,它需要安装Python3.5和OpenCV 2.4.13,所以我给出了这个命令:

代码语言:javascript
运行
复制
conda create -n ziomario pip python=3.5
conda activate ziomario

此时,我应该安装OpenCV 2.4.13,并发出以下命令:

代码语言:javascript
运行
复制
conda install -c conda-forge opencv=2.4.13

但它不起作用,因为这是:

代码语言:javascript
运行
复制
(ziomario) root@ziom-Z87-HD3:/home/ziom# conda install -c conda-forge opencv=2.4.13
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: / 
Found conflicts! Looking for incompatible packages.
This can take several minutes.  Press CTRL-C to abort.
Examining @/linux-64::__glibc==2.23=0:  25%|██▌       | 1/4 [00:00<00:00, 6026.3Examining python=3.5:  50%|█████     | 2/4 [00:00<00:00, 7351.98it/s]           Examining conflict for python opencv:  25%|██▌       | 1/4 [00:00<00:00, 10979.8                                                                                failed

UnsatisfiableError: The following specifications were found
to be incompatible with the existing python installation in your environment:

Specifications:

  - opencv=2.4.13 -> python=2.7

Your python: python=3.5

If python is on the left-most side of the chain, that's the version you've asked for.
When python appears to the right, that indicates that the thing on the left is somehow
not available for the python version you are constrained to. Note that conda will not
change your python version to a different minor version unless you explicitly specify
that.

The following specifications were found to be incompatible with your CUDA driver:

  - feature:/linux-64::__cuda==9.0=0

Your installed CUDA driver is: 9.0

Opencv=2.4.13需要python=2.7,但存储库需要Python3.5。该怎么办呢。

EN

回答 2

Stack Overflow用户

发布于 2020-03-11 22:17:28

这很奇怪,因为repo明确地说它应该使用您正在尝试使用的内容。我的猜测是,有人在依赖列表上犯了一个错误。先尝试升级Opencv,然后再联系repo维护者,因为他们写了这个矛盾。

票数 0
EN

Stack Overflow用户

发布于 2020-03-11 22:27:55

为此,您可能需要使用"pyenv“

我找到了一个非常有用的网站:https://realpython.com/intro-to-pyenv/

假设您使用的是Ubuntu或Debian系统,我将对这些步骤进行总结。

首先,如果您还没有下载依赖项,请下载它:

代码语言:javascript
运行
复制
$ sudo apt-get install -y make build-essential libssl-dev zlib1g-dev \
libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev \
libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev python-openssl

然后使用pyenv-installer:

代码语言:javascript
运行
复制
$ curl https://pyenv.run | bash

这将安装pyenv以及一些有用的插件:

用于pyenv的实际pyenv application

  • pyenv-virtualenv:插件和用于更新pyenv

  • pyenv-doctor:插件的虚拟environments

  • pyenv-update:插件,用于验证pyenv和构建依赖关系的installed

  • pyenv-which-ext:插件用于自动查找系统命令的

在运行结束时,您应该看到如下所示:

代码语言:javascript
运行
复制
WARNING: seems you still have not added 'pyenv' to the load path.

# Load pyenv automatically by adding
# the following to ~/.bashrc:

export PATH="$HOME/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"

The output will be based on your shell. But you should follow the instructions to add pyenv to your path and to initialize pyenv/pyenv-virtualenv auto completion. Once you’ve done this, you need to reload your shell:
代码语言:javascript
运行
复制
$ exec "$SHELL" # Or just restart your terminal

然后,您可以使用该命令安装python的版本:

代码语言:javascript
运行
复制
$ pyenv install -v 3.5

还有更多。(请转至网站)

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/60637825

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档