简体   繁体   English

如何在python中安装模块和包

[英]How to install module and package in python

I'm trying to start with OpenCV with python. 我试图用OpenCV开始使用python。 I have experience c# and I have knowledge of c++. 我有c#的经验,我对c ++有所了解。 However, I feel more comfortable with python instead of c++. 但是,我对python而不是c ++感觉更舒服。 I installed OpenCV then python 3.4 in visual studio 2015. At the beginning I've received an error numpy, "Module couldn't be found", thankfully, I resolved it. 我在visual studio 2015中安装了OpenCV然后安装了python 3.4。一开始我收到了一个错误numpy,“模块无法找到”,谢天谢地,我解决了它。 The I got another error cv2 "Module couldn't be found" I asked an question yesterday, but I think the question has been left away. 我得到了另一个错误cv2“无法找到模块”我昨天问了一个问题 ,但我认为这个问题已被遗忘。 Anyways, I'm not complaining, but I still need some help please to stat with OpenCV in python. 无论如何,我不是在抱怨,但我仍然需要一些帮助,请在python中使用OpenCV进行统计。

Installing python 3.4 Successful 安装python 3.4 成功

Installing numpy Successful 安装numpy 成功

installing matpilotlib Failed 安装matpilotlib 失败

在此输入图像描述

installing cv2 Failed 安装cv2 失败

在此输入图像描述

can anybody help me please thanks a lot. 请有人帮助我,非常感谢。

You can install matplotlib using pip (which is already installed on your machine - mentioned in your previous quesiton): 您可以使用pip安装matplotlib(已经安装在您的计算机上 - 在您之前的问题中提到):

pip install matplotlib

more info: http://matplotlib.org/faq/installing_faq.html 更多信息: http//matplotlib.org/faq/installing_faq.html

It's very common to install Python packages through pip today (recursive acronym for pip installs packages ). 今天通过pip安装Python包是很常见的( pip installs包的递归缩写)。 However, this is not that trivial under Windows. 但是,这在Windows下并不是那么简单。

How to install matplotlib : 如何安装matplotlib

Try to open a commandline and type in pip install matplotlib . 尝试打开命令行并输入pip install matplotlib If this does not work, you'll need to do some more work to get pip running. 如果这不起作用,你需要做更多的工作才能让pip运行。 I gave a detailed answere here: Not sure how to fix this Cmd command error? 我在这里给出了详细的回答: 不确定如何解决这个Cmd命令错误? .

How to install OpenCV: 如何安装OpenCV:

The Python OpenCV DLL must be made for your version of Python and your system architecture (or, to be more specific, the architecture your Python was compiled for). 必须为您的Python版本和您的系统架构(或者更具体地说,是Python编译的架构)制作Python OpenCV DLL。

  • Download OpenCV for your Python version (2/3) 下载适用于您的Python版本的OpenCV(2/3)
  • Try replacing the x64 version with the x86 version 尝试用x86版本替换x64版本
  • There are a lot of different binaries here: http://www.lfd.uci.edu/~gohlke/pythonlibs/#opencv . 这里有很多不同的二进制文件: http//www.lfd.uci.edu/~gohlke/pythonlibs/#opencv Try to get the one exactly matching your Python version and System architecture and install it via pip (cp35 means CPython version 3.5 ect.). 尝试使用与Python版本和系统架构完全匹配的版本并通过pip安装它(cp35表示CPython版本3.5等)。

If you have the OpenCV .whl file matching your system configuration, do pip install file.whl . 如果您的OpenCV .whl文件与您的系统配置匹配,请执行pip install file.whl

Hope this helps! 希望这可以帮助!

您可能最好使用pythonxy等软件包作为开始,例如从https://python-xy.github.io/ ,而不是手动安装每个单独的软件包。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM