I am trying to run a script that has the line:
import lib.sort as sort
When I try to run it I get the error:
ModuleNotFoundError: No module named 'lib.sort'
So then I did:
import lib
but then when I tried to use lib.sort I get:
AttributeError: module 'lib' has no attribute 'sort'
Can someone point out my presumably basic mistake?
lib module in Python does not have sort method. Do you want to sort the elements? Can you explain what functionality you need?
[#user1551817]
Try: pip install lib
Then, run dir(lib) to check if 'sort' function is available.
As far as I tried, lib doesnt have sort method.
Related
I want to start up a project, which imports a module named kzyvad. It occurs error ImportError: No module named 'kzyvad'. However, if I execute pip install kzyvad, it returns ERROR: Could not find a version that satisfies the requirement kzyvad.
Did someone ever successfully install kzyvad?
I don't know where you found your module but I looked for it and I could not find it, I think the guy who wrote 'kzyvad' did a mistake while writing, and if pip gives you this error, it means it doesn't exist.
If this kzyvad.py is written by you, then keep this file/module in a same folder and do this in main.py file:
from kzyvad import *
You can use it's functions and classes in your main.py file
http://i.imgur.com/Kyw8Rip.png
It says grequests is succesfull installed. But when i want to import it. I get a error saying "No module named grequests"
How can i fix this?
System = OS 10.11.6
In command line
pip list
Check package in there
I have installed and am trying to use fbconsole: https://github.com/facebook/fbconsole/
Looking at the instructions, I can make the first couple of steps work:
import fbconsole
fbconsole.AUTH_SCOPE = ['publish_stream', 'publish_checkins']
fbconsole.authenticate()
But when I try
fbconsole.logout()
I get
AttributeError: 'module' object has no attribute 'logout'
Looking at the file that's being installed, I do see both the authenticate() and the logout() module. Is the package not being installed correctly?
It's work correct for me!
Reinstall fbconsole with this command:
python setup.py install
I hope it's work for you too!
Good Luck
Is there same name with fbconsole.py or python package fbconsole in your python path?
If so then:
import fbconsole
print fbconsole.__file__
print dir(fbconsole) # look if the logout in the fcconsole module
then watch the file of the fbconsole module you import is what,
If not , you can atempte to remove the fbconsole.pyc in your python path(just use the same above code) and looks is it works.
I followed step with nlopt
and get a _nlopt.pyd
When i try to use nlopt.py(it's have code like follow)
import _nlopt
and it's gives
ImportError: No module named _nlopt
I am sure the _nlopt.pyd is in the folder
And it's work in Windows7
Any help?
Make sure you first configured with the --enable-shared flag before compiling
everybody!
the built-in pycurl module doesn't define Curl object
conn = pycurl.Curl()
Error message:
"pycurl" module has no attribute Curl
so I download the latest pycurl and install it,but it only works when I ran the code in interactive python interpreter,and I got the same error when I ran it as a script file.
It seems that when I run it as a script file,the old pycurl module will be included.
How can I import the new pycurl module or remove the old pycurl module?Thanks in advance.
PS.
in pydoc,the pycurl(old) module under '.' is clickable,redirecting to a page only saying "module has no attribute Curl",while the one(new) under '/usr/local/lib/python2.7/dist-packages' is gray and unclickable
It's a matter of when it is found. The basic import handler used in Python looks at the paths specified in sys.path in order to find a module, and after it has found something matching pycurl it will use it and not look further.
So, you need to either put your own copy of pycurl higher in the module search path, or in your own script do something like sys.path.insert(1, '/path/to/my-pycurl') with the path to the directory containing the pycurl package.