Wenn ich !pip install geocoder
in Jupyter Notebook ausführen bekomme ich die gleiche Ausgabe wie pip install geocoder
im Terminal laufen, aber das Geocoder-Paket ist nicht verfügbar, wenn ich versuche, es zu importieren.Installation eines Pip-Pakets aus einem Jupyter-Notebook funktioniert nicht
Ich bin mit Ubuntu 14.04, Anaconda 4.0.0 und 8.1.2
Installation Geocoder pip:
!pip install geocoder
The directory '/home/ubuntu/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/ubuntu/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting geocoder
Downloading geocoder-1.15.1-py2.py3-none-any.whl (195kB)
100% |████████████████████████████████| 204kB 3.2MB/s
Requirement already satisfied (use --upgrade to upgrade): requests in /usr/local/lib/python2.7/dist-packages (from geocoder)
Requirement already satisfied (use --upgrade to upgrade): ratelim in /usr/local/lib/python2.7/dist-packages (from geocoder)
Requirement already satisfied (use --upgrade to upgrade): six in /usr/local/lib/python2.7/dist-packages (from geocoder)
Requirement already satisfied (use --upgrade to upgrade): click in /usr/local/lib/python2.7/dist-packages (from geocoder)
Requirement already satisfied (use --upgrade to upgrade): decorator in /usr/local/lib/python2.7/dist-packages/decorator-4.0.10-py2.7.egg (from ratelim->geocoder)
Installing collected packages: geocoder
Successfully installed geocoder-1.15.1
Dann versuchen Sie es zu importieren:
import geocoder
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-4-603a981d39f2> in <module>()
----> 1 import geocoder
ImportError: No module named geocoder
ich auch versucht, das Notebook herunterfahren und ohne Glück neu starten.
Edit: Ich habe festgestellt, dass die Verwendung des Terminals das Geocoder-Paket in /home/ubuntu/.local/lib/python2.7/site-packages installiert und mit einem Notebook in/usr/local/lib/python2 installiert. 7/dist-packages, die nicht im Pfad sind. sys.path.append('/usr/local/lib/python2.7/dist-packages')
löst das Problem für die aktuelle Sitzung.
Also, wie kann ich den Pfad dauerhaft ändern oder pip sagen wo Geocoder zu installieren?
Das ist Python 2 Pakete. Verwendet Ihr Notebook einen Python 2-Kernel oder einen Python 3-Kernel? – nitind
Seine Verwendung von Python 2 –
['PYTHONPATH'] (https://docs.python.org/2/using/cmdline.html#envvar-PYTHONPATH) – Alik