[Python] Python geopy install

Discussão em 'Python' iniciado por Stack, Junho 3, 2025.

  1. Stack

    Stack Membro Participativo

    I am trying to install Geopy in Python. How do I do this in really simple terms? I have Python 3.4.0 launcher installed. Where do I write the Geopy install command? On a text file with a .py extension? Or in Terminal? I have read to ways to install Geopy, using easy-install and pip. Which one should I use? Below is one example I have read:

    mkdir -p $HOME/lib/pythonX.Y, where X.Y is the Python version, and press Enter.
    easy_install-X.Y package, where package is the name of the package to install, and press Enter.


    Below is another installation I have read:

    pip install geopy

    >>> from geopy.geocoders import Nominatim
    >>> geolocator = Nominatim()
    >>> location = geolocator.geocode("175 5th Avenue NYC")
    >>> print(location.address)
    Flatiron Building, 175, 5th Avenue, Flatiron, New York, NYC, New York, ...
    >>> print(location.latitude, location.longitude)
    (40.7410861, -73.9896297241625)
    >>> print(location.raw)
    {u'place_id': u'9167009604', u'type': u'attraction', ...}


    So, in the above code, where am I writing this, because this is printing the result upon request? In Terminal? I have the Python launcher but I can't seem to write a new script within it, it just loads text files with the .py extension.

    Apologies for the asking about the basics here. Very much a novice. If anyone could explain how I could install Geopy and execute the above geocoding technique in a step-by-step way, it would be very much appreciated.

    Continue reading...

Compartilhe esta Página