Caffe Framework :Importing Error - python-2.7

I followed the instructions from "https://gist.github.com/nikitametha/c54e1abecff7ab53896270509da80215" and installed caffe framework.
But ,when I import caffe from some other directory ,it is showing this error
caffe framework was installed but, it still shows the import error -
No module named caffe
How to solve this issue?
Thank you...

You need to add ~/caffe/python to your $PYTHONPATH. either
~$ PYTHONPATH=$PYTHONPATH:~/caffe/python python
>>> import caffe
Or you can do it inside python
>>> import sys
>>> sys.path.insert(0, '~/caffe/python')
>>> import caffe
Alternatively, you can modify your ~/.bashrc file and fix PYTHONPATH environmet variable there

Related

Tensorflow API Ubuntu 14.04 python 2.7 Error

from utils import label_map_util
ImportError: No module named utils
I tried to fix this problem but I can't, this similar my case
Case 1 and Case 2
please help me if Ubuntu 14.04 with python 2.7 fix it
thanks in advance!!
First, clone this:https://github.com/tensorflow/models and include the path to your code the folder is in the research folder research/object_detection:
import sys
sys.path
sys.path.insert(0, 'path/to/your/object_detection')
Or this way
import( os )
os.chdir( 'path/to/your/object_detection' )
and change your import to be:
from object_detection.utils import label_map_util

django/db/backends/mysql/operations.py full path please for ubuntu

Need full path for django.db.backends folder.
I already searched for django folder in usr/lib, usr/local/lib/python2.7/dist-packages
but unable to find it.
Run this command:
$ locate django/db/backends.
This will give you all the possible paths where django/db/backends exists.
So maybe one more trick - python modules has a __file__ attribute:
>>> from django.db import models
>>> models.__file__
'/usr/local/lib/python2.7/dist-packages/django/db/models/__init__.pyc'
And this is for backends module in python3:
>>> from django.db import backends
>>> backends.__file__
'/home/myusername/.local/lib/python3.5/site-packages/django/db/backends/__init__.py'
It is pretty useful - and works just from python console.
Good luck :)

cannot import name module with module correctly installed

new in python.
I have python 2.7.
I just installed a new module (beatifulsoup) from cmd in windows 7 which is correctly installed : When I enter the python consol from the cmd I can import succesfully bs4 without error.
My problem is that I cannot import it when I am using Aptana studio. Or if I code it in sublimetext and save it as a py file, when I run it I get the error message "cannot import name beautifulsoup 4". I don't get why? Is it a problem of pydev environment on aptana? If yes how can I add modules to Aptana and sublimetext3 ?
Are you trying to import like this:
from bs4 import BeautifulSoup
If not, try it that way. Hope this helps!
(Perhaps you should add your import statement to the question so we can see if there is a problem with the statement or if the issue resides somewhere else)

How to import module from a sibling directory in python 2.7?

DATAMINING/
DISEASED/
kmeans.py
NORMAL/
kmeans.py
I am a beginner in python 2.7.My directory structure is given above.
I want to import DISEASED/kmeans.py to NORMAL/kmeans.py.
How to do that?
Thanks in advance.
You can import DISEASED/kmeans.py module like this,
from DISEASED import kmeans
Note: You must run NORMAL/kmeans.py file from DATAMINING directory like this,
python -m NORMAL.kmeans

import error in django-sendsms

I'm trying to use django-sendsms based on this documentation
I downloaded the package,copied it's folder in c: and ran this command in shell
c:
cd django-sendsms
python setup.py install
these commands installed django-sms in sitepackages folder.then based on the documentation I added this backend to settings.py:
SENDSMS_BACKEND = 'sendsms.backends.console.SmsBackend'
and in views.py :
from sendsms import api
api.send_sms(body='I can haz txt', from_phone='+41791111111', to=['+41791234567'])
but I get this error:
No module named importlib
every thing is based on the documentation,I don't know what's wrong with it!
Which version of Python are you using? It seems that module (in sendsms/util.py) will import the library called importlib which only exists in Python 2.7. If you are using Python 2.6 or lower, that library do not exist.