Kann nicht importieren requests_oauthlib
Habe ich Fehler beim importieren requests_oauthlib
, obwohl ich es installiert erfolgreich:
$ sudo pip install requests requests_oauthlib
Requirement already satisfied (use --upgrade to upgrade): requests in /Library/Python/2.7/site-packages
Requirement already satisfied (use --upgrade to upgrade): requests-oauthlib in /usr/local/lib/python2.7/site-packages
Cleaning up...
~ alex$ python
Python 2.7.5 (default, Mar 9 2014, 22:15:05)
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from requests_oauthlib import OAuth1Session
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named requests_oauthlib
update:
>>> import sys; print sys.path
['', '/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload', '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC', '/Library/Python/2.7/site-packages']
Bitte Bearbeiten deine Frage mit den Ergebnissen aus der Ausführung dieses in python:
import sys; print sys.path
InformationsquelleAutor | 2014-11-17
Du musst angemeldet sein, um einen Kommentar abzugeben.
requests-oauthlib
installiert ist, an/usr/local/lib/python2.7/site-packages
.Aber das letztere ist nicht in deinem PYTHONPATH/sys.Pfad
So fügen Sie es hinzu. Dies ist eine Möglichkeit.
Erfahren Sie mehr über pythonpath
übrigens, warum glaubst du, dass es nicht in meiner PYTHONPAHT, die Ausgabe sagt, es ist
Requirement already satisfied (use --upgrade to upgrade): requests-oauthlib in usr/local/lib/python2.7/site-packages
Ich bin mir nicht sicher, aber ich würde vermuten, dass
pip
sieht in diesem Verzeichnis über einige default-Einstellung, aber die Anwendung sieht nie irgendwo, aber die Verzeichnisse angegeben, die von der pythonpath.wie kann ich hängen Sie es dauerhaft?
InformationsquelleAutor John Mee
Hatte ich dieses Problem und neben der Herstellung sicher, dass der richtige Pfad eingestellt wurde, ich fand, dass das laufen
$ pip install requests requests_oauthlib
gelöst ist das Problem, wie oauthlib ist nicht im Lieferumfang enthalten im Kern
requests
Bibliothek.https://github.com/requests/requests-oauthlib
InformationsquelleAutor joshi123