8/30/2023 0 Comments Anaconda vs python 2.7![]() In a Python interpreter you can always check the version of a library you are using after import by running the command: This is quite normal behaviour and for the most part should not cause you any concern as you are ultimately building an environment optimised for you. You may notice that when you are installing a library it wants to downgrade a package. It is worth noting that packages are being updated all the time (as is Python). I recommend attendees of my courses to install it. The anaconda way is the best way I can see to quickly get set up. I did get them working in a virtual environment, which is an excellent way of doing testing. The reason for this, for me at least, was that installing libraries like rasterio and shapely would never seem to quite work on a ‘standard’ python install. Anaconda is definitely not the only way to go, though experience tells me this is the easiest for a beginner. We have taken a very quick walk through setting up Python on a windows computer and installing the required libraries in order to become a Python Geospatial professional. Finally, while not an anaconda step I strongly recommend installing these two pieces of software:Īnd while you are at it you may as well get set up with Postgres / PostGIS (after all you installed psycopg2, right?) : Where this is not true I have added the correct import statements below (please don’t type the text in brackets) import sklearn (for scikit-learn) import skimage (for scikit-image) import cv2 (for opencv)ħ. Not all packages follow import PACKAGENAME If it does error then restart and run the associated anaconda install command from step 4. If it runs without an error you have installed that library. Which will tell you the version of Python you are running and then: import PACKAGENAME You can check to see if a package is installed by opening up the anaconda command prompt and typing: python … you can try the following command: pip install PACKAGENAMEįor more information about managing packages in anaconda have a look here.Ħ. If after you have searched for the package in anaconda using the following command but the library has not been found… conda search PACKAGENAME However, anaconda allows packages to be installed via pip install. That can be frustrating for beginners we have all been there. Sometimes the package you are looking for is not available in anaconda. ![]() For example the fiona library will install at the same time as the shapely library.ĥ. These are know as dependencies for the original library. ![]() When installing these Python libraries other libraries may also be installed at the same time. Will also install fiona (read / write geospatial files) Shapely – working with manipulation and analysis of planar geometric objects.psycopg2 – connecting to Postgres / PostGIS.rasterio – reader / writer of geospatial rasters.Below is a list of the packages available, but first here is a list of commands to get you up and running: conda install -c conda-forge gdal Why anaconda? Well, I think that it has all the packages that you need for Geospatial programming. They are mostly simple and intuitive, however any help is always useful.Ĥ. Assuming that you have installed anaconda from above, use this cheat sheet to familiarise yourself with the common commands. To make life easy add a link to the anaconda command prompt on your desktop for ease of access.ģ. You can have both Python 3 and Python 2.7 running on your machine if you want to make things more complex (see xkcd cartoon above) – but unless you have to, don’t. Why? The Python 2.7 clock is ticking – don’t get caught out in 2020 as 2.7 will no longer be maintained. Use the link below to download.Īnaconda comes with a whole heap of useful stuff including Jupyter Notebook and Spyder (an interactive development environment).Ģ. ![]() I have found, if you are completely starting from scratch, that anaconda is the best place to start. This post is a series of steps to how I would set up Python 3 today, with Windows 10 as my operating system. There will be a second post that will give an introduction to Jupyter Notebooks. This blog post is for anyone who is new to programming with Python. If you have not used Python before and you are looking to get started here are a few recommendations to get you up and running. I have written a lot in the past about using Python for GIS and Earth Observation.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |