Jupiter Notebookで!pip install geocoder
を実行すると、端末にpip install geocoder
が実行されたと同じ出力が得られますが、インポートしようとするとジオコーダパッケージは利用できません。それをインポートしようと次にJupyterノートブック内から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
:
import geocoder
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-4-603a981d39f2> in <module>()
----> 1 import geocoder
ImportError: No module named geocoder
私も試した
私はUbuntuの14.04、アナコンダ4.0.0を使用して8.1.2
インストールジオコーダーのピップよノートブックをシャットダウンし、不運にも再起動します。
編集:端末を使って/home/ubuntu/.local/lib/python2.7/site-packagesにジオコーダーパッケージをインストールし、ノートブックを使用すると/ usr/local/lib/python2にインストールされていることがわかりました。 7/dist-packagesはパスに含まれていません。 sys.path.append('/usr/local/lib/python2.7/dist-packages')
は、現在のセッションの問題を解決します。
パスを永続的に変更したり、ジオコーダーのインストール先を指示するにはどうすればよいですか?
は、これらは、Python 2つのパッケージです。あなたのノートブックはPython 2カーネルまたはPython 3カーネルを使用していますか? – nitind
Python 2 –
['PYTHONPATH'](https://docs.python.org/2/using/cmdline.html#envvar-PYTHONPATH) – Alik