![]() Make sure you are working in your base environment. The package we are looking for in our example is the Google API Python Client. ![]() Anaconda has its own package repository and there are many more repositories for us to find our packages. Luckily, there are a lot of packages available to us. Google provides us with a package to do this, but these are not installed in your default environment. Let’s say your project requires you to connect to one of the Google API’s. Now that we ran our first script, you might want to add a new package. Managing packages from within your Terminal Another cell for the world to see!Ĭongratulations! You’ve just set up a Workspace in Visual Studio Code to run Python projects! Now let’s dig a little deeper and see if we can install new packages into our environment. # This is the first cell of our Python code. ![]() You can also right-click the file and select ‘Run Python File in Terminal’ or ‘Run Python File in Interactive Python Window’.Īfter running your first script, your should see the Interactive Python Window on the right of your code and return something like this. The Interactive Python Window is extremely useful, since it gives you more feedback on debugging your code, but also allows you to run different bits of codes called cells in your Python script. You can run it directly in the Terminal or from the Interactive Python Window. We’ll get into packages in a bit, but first let’s see if we can run that Python file of ours. This is because VS Code will automatically recognize you are editing a Python file. #%% # This is the first cell of our Python code print('Hello world!') #%% # This is another cell print('Another cell for the world to see!')Īround this time you might get all sorts of messages like ‘ Pylint package not installed’, upon opening your file. Copy the code below into your file and save it.Now, create a new file called helloworld.py within your Workspace.The great thing about a Workspace, is that you can customize the settings for each individual Workspace. You now have set up a custom Workspace in VS Code. Save your Workspace-file within the folder.Go to the menu and select File > Save Workspace as.Click on Open Folder and select the folder.I’ve created a dummy folder called DataScienceProject for testing purposes. Visual Studio Code is a powerful, lightweight code editor that lets you configure your own workspaces for each of your projects. The welcome screen on your first start of Visual Studio Code. Notice there’s an option to install VS Code. Upon opening the Anaconda Navigator, you see Anaconda has already set up some tools and packages like Jupyter, Spyder. Managing different environments within Anaconda Navigator After installing Anaconda, start Anaconda Navigator. We will use Python 3.7 for now, just to be sure. Although I personally prefer to get the latest version of Python, sometimes Python packages require a specific version of Python - hence the reason why I will show you how to set up multiple Python environments. ![]() You will be able to download Anaconda with Python 3.7 and Python 2.7. Go to the Anaconda website and download the latest version of Anaconda for your platform. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |