importerror

How to use OpenCV in Python?

非 Y 不嫁゛ 提交于 2019-11-28 06:17:21
I have just installed OpenCV on my Windows 7 machine. As a result, I get a new directory: C:\OpenCV2.2\Python2.7\Lib\site-packages In this directory, I have two files: cv.lib and cv.pyd . Then I try to use the opencv from Python. I do the following: import sys sys.path.append('C:\OpenCV2.2\Python2.7\Lib\site-packages') import cv As a result I get the following error message: File "<stdin>", line 1, in <module> ImportError: DLL load failed: The specified module could not be found. What am I doing wrong? ADDED As it was recommended here , I have copied content of C:\OpenCV2.0\Python2.6\Lib\site

How to get current import paths in Python?

自闭症网瘾萝莉.ら 提交于 2019-11-28 06:11:42
I get an ImportError exception somewhere in the code, but the same module can be imported safely at startup of the application. I'm curious to see which paths Python looks for modules to import, so that I can trace why this problem occurs. I found this: print sys.path Is this the list of ALL paths that system looks when tries to import a module? Praveen Gollakota The path locations that python checks by default can be inspected by checking sys.path . import sys print(sys.path) marsh If you want a bit better formatting: import sys from pprint import pprint pprint(sys.path) Sys.path is a list of

unexpected reserved word import in node.js

爷,独闯天下 提交于 2019-11-28 05:12:20
I'm trying to run node.js backend server. I've received error unexpected reserved word on import in Node.js file. The lines in file core.module.js is: 'use strict'; import lodashMixins from './lodashMixins.js' ... other imports and configurations ... I launch simple command: node core.module.js It's not uncommon error, but usually it happens with other libraries. I haven't seen solution for Node.js. How should I fix this? I'm using Windows Server. Edit: I've find out that it's ES6, but how could I launch it? It looks like backend for the application, but I have no idea what command should I

Python3: Attempted relative import in non-package

允我心安 提交于 2019-11-28 05:03:51
问题 I'm so sorry about this basic question, because it's similar to this: Stumped by relative imports But I'm trying to follow the PEP328 http://www.python.org/dev/peps/pep-0328/#guido-s-decision and it doesn't work for me :( These are my files: dev@desktop:~/Desktop/test$ ls controller.py __init__.py test.py 2to3 says all it's right: dev@desktop:~/Desktop/test$ 2to3 . RefactoringTool: Skipping implicit fixer: buffer RefactoringTool: Skipping implicit fixer: idioms RefactoringTool: Skipping

Python Import Class With Same Name as Directory [duplicate]

a 夏天 提交于 2019-11-28 03:09:53
问题 This question already has an answer here: Python import precedence: packages or modules? 4 answers Lets say I have the following python source file layout: lib/foo.py lib/foo/bar.py and then in my source code: from foo import gaz I get an import error: ImportError: No module named foo How can I have a .py file and a directory with the same name so I can do the following: from foo import gaz from foo.bar import wakawaka thanks in advance! 回答1: The actual problem you are having, using a single

my jupyter notebook fails to import anaconda modules consistently

那年仲夏 提交于 2019-11-28 02:36:37
问题 I can't get my jupyter notebook properly import any modules. The weird thing is, I am able to import numpy but not pandas with Sublime. I wiped out every python related content on my Mac and re-installed anaconda. Here's the import error message for numpy on jupyter: ImportError Traceback (most recent call last) <ipython-input-1-5a0bd626bb1d> in <module>() ----> 1 import numpy /Users/z-wang/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/numpy/__init__.pyc in <module>() 183

Import error in twilio

落爺英雄遲暮 提交于 2019-11-28 02:02:47
I am having the same problem as this thread regarding twilio-python : twilio.rest missing from twilio python module version 2.0.8? However I have the same problem but I have 3.3.3 installed. I still get "No module named rest" when trying to import twilio.rest. Loading the library from stand alone python script works. So I know that pip installing the package worked. from twilio.rest import TwilioRestClient def main(): account = "xxxxxxxxxxxxxxxx" token = "xxxxxxxxxxxxxxxx" client = TwilioRestClient(account, token) call = client.calls.create(to="+12223344", from_="+12223344", url="http:/

Cannot import Scikit-Learn

假装没事ソ 提交于 2019-11-27 23:08:34
I tried to install scikit-learn on my Linux Mint 12 but failed. I downloaded the package from http://pypi.python.org/pypi/scikit-learn/ and installed with sudo python2.7 setup.py install I then changed the directory to home and started python2.7 shell. On importing sklearn I got: >>> import sklearn /usr/lib/python2.7/dist-packages/scipy/spatial/__init__.py:7: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility from ckdtree import * /usr/lib/python2.7/dist-packages/scipy/spatial/__init__.py:7: RuntimeWarning: numpy.ndarray size changed, may indicate binary

Can't locate import javax.inject.Inject package

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-27 23:03:15
问题 I'm trying to implement Dagger as a dependency injector in an IntelliJ project, but my code is failing on: import javax.inject.Inject; Intellij is finding the ' javax ' package, but not the ' inject ' package, so it fails. I am new to Android, so I apologize if this is a no brainer, but can anyone tell me why the inject package is not being found? 回答1: Dagger depends on JSR 330, the Java standard annotations which are used for dependency injection (think: @Inject , @Singleton , etc.). This is

Sphinx: how to exclude imports in automodule?

喜你入骨 提交于 2019-11-27 22:12:45
I have a Raspberry Pi project written in Python that uses RPi.GPIO module. All the work on the code is done on a Windows box where RPi.GPIO will not install and every time I try to run autodoc it crashes saying it cannot import RPi.GPIO. D:\cube\docs\ledcube.rst:4: WARNING: autodoc: failed to import module u'ledcube' ; the following exception was raised: Traceback (most recent call last): File "C:\Python27\lib\site-packages\sphinx-1.2b1-py2.7.egg\sphinx\ext\autodoc. py", line 326, in import_object __import__(self.modname) File "D:\cube\ledcube.py", line 2, in <module> import RPi.GPIO as GPIO