Po uruchomieniu !pip install geocoder
w Notatniku Jupyter otrzymuję taki sam wynik, jak uruchomienie pip install geocoder
w terminalu, ale pakiet geocoder nie jest dostępny, gdy próbuję go zaimportować.Instalowanie pakietu pip z Notatnika Japyter nie działa
Używam Ubuntu 14.04, Anaconda 4.0.0 i 8.1.2 pip
Instalacja geocoder:
!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
Następnie spróbuj go importować:
import geocoder
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-4-603a981d39f2> in <module>()
----> 1 import geocoder
ImportError: No module named geocoder
Próbowałem też zamknięcie notebooka i ponowne uruchomienie bez żadnego szczęścia.
Edycja: Znalazłem, że za pomocą terminala instaluję pakiet geocoder w /home/ubuntu/.local/lib/python2.7/site-packages i używając notebooka instaluję go w/usr/local/lib/python2. 7/dist-pakiety, których nie ma na ścieżce. sys.path.append('/usr/local/lib/python2.7/dist-packages')
rozwiązuje problem dla bieżącej sesji.
Jak zatem trwale zmienić ścieżkę lub powiedzieć, gdzie można zainstalować geocoder?
Są Python 2 pakiety. Czy twój notebook używa jądra Python 2 lub jądra Python 3? – nitind
Używa Pythona 2 –
['PYTHONPATH'] (https://docs.python.org/2/using/cmdline.html#envvar-PYTHONPATH) – Alik