![]() ![]() For example, if you make and activate an environment called “test”, you will see (test) at the beginning of the prompt. When you do, you will see the name of the currently active conda environment inside of the parentheses. Later on, as you become more familiar with conda, you should begin creating new environments for each project you work on. This base environment is where all of the pre-loaded packages are contained. This tells you that you are currently inside of the conda virtual environment called base. Notice that at the beginning of the prompt, you see (base). Click on it to use conda for the first time: If you type Anaconda in your Windows search bar, you will see Anaconda Prompt come up. Before we set it up in Git Bash, it is useful to see what it looks like when you are using conda.Īnaconda and Miniconda come with a program called Anaconda Prompt on Windows, which is essentially just CMD terminal that is pre-set-up for conda. Once Anaconda is downloaded and installed, you will be ready to use conda. Run Anaconda Prompt (skip this section if you are familiar with conda) You can download the installer for Anaconda here. If you are low on hard drive space, Miniconda is fine - just don’t be surprised by the number of packages you’ll have to install that would be ready out of the box with Anaconda (Pandas, Numpy, Matplotlib, Seaborn, Jupyter, Scikit-learn, etc.). Miniconda is a barebones version of the Anaconda distribution, and is a little less beginner-friendly, coming with only Python, conda, pip, and a couple of dependencies necessary to make them work. Install AnacondaĪlthough Codecademy recommends installing Miniconda, I highly recommend saving some headaches and installing the full version of Anaconda if you have the space on your PC and you are serious about getting into Data Analysis/Data Science. It is used primarily in the Data Science world, but can be used for much, much more.įor a detailed breakdown, read the excellent post by Jake VanderPlas (Software Engineer, Google), Conda: Myths and Misconceptions Instructions 1. In short, conda is a very powerful package manager that excels at managing dependencies and offers an easy way to create and use virtual environments for your projects. ![]() (This post assumes you have already installed and used Git Bash previously) What is conda, and why would I want to use it?īefore we dive into the instructions, it’s important to understand a little about conda and how it differs from pip. If you use and enjoy Git Bash and want to take advantage of the power of conda without switching terminals, follow the instructions below to get it up and running. ![]() For example, on a Windows machine I might add a line that reads C:\myscripts.If you’re a Windows user following along with the Data Science or Computer Science career paths on Codecademy (or the Learn Python courses), you may have noticed the recommendation to use Git Bash for your terminal, and the instructions on installing Python via Miniconda, but the lack of guidance on using conda within the Git Bash terminal rather than CMD or Anaconda Prompt. Within that text file, you can list directories that you want to include in your PYTHONPATH, one per line. pth (e.g., a file named extrapythonfolders.pth would be fine). ![]() Create a new text file in that directory, naming it such that it has the file extension. Each Anaconda installation should have a folder of that name. In the screenshot above, notice the site-packages folder. If we want to more permanently add a folder to our PYTHONPATH, we can do so by creating a. This approach would only work until we closed that instance of the python compiler we would need to re-run it each time we started a python command line. Where “/path/to/my/package” should be changed to the file path to the folder containing your python script file. If we want to temporarily add a directory to our python, we could simply run the following commands in the python terminal that we are using to run the script: One way to solve this problem is add your preferred directory to your PYTHONPATH. However, sometimes it is helpful to have a convenient “working directory” for temporary or unfinished code, and you may not want to navigate python to that directory every single time you call the code. These are also the best practices for one’s own code. If it is someone else wrote the code module, the best way to do that is to install it using conda or, if that isn’t possible, by using pip or a setup.py file. Ideally, we want to avoid this issue by properly installing modules. Unless my script is in one of those folders (or their subfolders), it will not be found by python unless you explicitly indicate the complete path when you call it from python (or if you start python in the directory in which the file resides). In my case, I get the following result on a personal Windows-based machine with a fresh Anaconda3 installation: Python -c "import sys print('\n'.join(sys.path))" ![]()
0 Comments
Leave a Reply. |