Installation Guide
User Manual:
Open the PDF directly: View PDF .
Page Count: 15
Download | ![]() |
Open PDF In Browser | View PDF |
Python Installation Guides Gustavo Amarante Contents 1 Required Programs to Install 2 2 Create a New Python Environment 3 2.1 Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.2 Mac 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 3 Installing Libraries 3.1 Anaconda Navigator 3.2 PyCharm 3.3 12 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 pip . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 4 Installing the Bloomberg API 15 1 1 Required Programs to Install No matter what your operating system is, you need to download and install the following three programs. Download and install Anaconda, which is the most popular python distribution package. Ana- conda will be your place to go to install new libraries, set up new enviroments and it already comes with the jupyter notebook, which is one of the python editors we are going to use. Go for the latest version of python. https://www.anaconda.com/distribution/ Download and install PyCharm (community version, which is free), which is the second python editor we are going to use and the one you will probably use the most. It has a lot of functionalities already built into it. https://www.jetbrains.com/pycharm/download/ Download and install Git, which is a required program to use the Version Control System (VCS). During instalation, there will be a lot of options to select, but just go for the default installation by clicking next on every step. https://git-scm.com/downloads 2 2 Create a New Python Environment A virtual environment is a tool that helps to organize the libraries required by dierent projects by creating isolated python virtual environments for them. This is one of the most important tools that most of the Python developers use. After you installed Anaconda, you will likely already have a python 3.7 environment set up but since we are going to use the Bloomberg API we need a python 3.6 environment. The following steps shows how to create a new environment and add it to your PyCharm project. The steps to set up a new python environment are a little dierent for each operating system. 2.1 Windows From the Start menu, open the Anaconda Navigator. On the left side, choose the Environments option and then click on the Create option below. 3 Choose any name for your new environment (in this example we named it py36) and select python 3.6. From the Start menu, open the Anaconda Prompt. 4 Run the following commands: • activate [environment name] • where python - changes the anaconda environment - The rst line after you run the command will show the address where the current environment is installed. Take note, we will use this address later. Open your project on PyCharm and go to File > Settings (or Ctrl+Alt+S). On the settings window, on the column on the left, select Project: [project name] > Project Interpreter. Click on the Gear symbol and then Add, as shown in the picture below. 5 On the new window select Conda Environment on the left, then select the option for existing environment. Click on the three dots next to the drop down menu and select the address of the environment le we found before. Some of the folders in the le path are hidden folders, so it is better to type the address by hand. 6 Click Ok and then mark the option "Make available for all projects". You are done! Now your PyCharm is running on the new python 3.6 environment. 2.2 Mac From the Start menu, open the Anaconda Navigator. On the left side, choose the Environments option and then click on the Create option below. 7 Choose any name for your new environment (in this example we named it py36) and select python 3.6. From the Start menu, open the Anaconda Prompt. 8 Run the following commands: • source activate [environment name] • which python - changes the anaconda environment - The rst line after you run the command will show the address where the current environment is installed. Take note, we will use this address later. Open your project on PyCharm and go to PyCharm > Preferences (or Command + , ). On the preferences window, on the column on the left, select Project: [project name] > Project Interpreter. Click on the Gear symbol and then Add, as shown in the picture below. 9 On the new window select Conda Environment on the left, then select the option for existing environment. Click on the three dots next to the drop down menu and select the address of the environment le we found before. Some of the folders in the le path are hidden folders, so it is better to type the address by hand. 10 Click Ok and then mark the option "Make available for all projects". You are done! Now your PyCharm is running on the new python 3.6 environment. 11 3 Installing Libraries A library (also called modules or packages) is a compilation of functionalities. Not all libraries are installed by default when you download anaconda, but the most popular libraries are listed on anaconda and you can use the anaconda navigator or PyCharm to install them. If you can not nd the library you are looking for in anaconda, you can still install them using pip. If you try to run a program that uses a library that is not installed, you will get an error that looks like this: ModuleNotFoundError : No module named ' numpy ' This means that will you have to install the library before running the program. 3.1 Anaconda Navigator To install a library using the Anaconda Navigator, click on "Environments" on the left columns and then select the environment you are using. You will see a list of all the libraries you have installed. On the drop-down menu at the top, select "not installed". You will see a list of all the libraries that are available to install. Use the search bar to nd the one you are looking for, mark the check box next to it and then click "apply". In the example below we are using the "numpy" library as an example. 12 3.2 PyCharm If you have set up your anaconda environment in PyCharm it will be connected to your anaconda navigator, which means you can install the library without leaving PyCharm. Go to "PyCharm" > "Preferences" (or Command + , ). On the preferences window, on the column on the left, select Project: [project name] > Project Interpreter and click on the "+" at the bottom. Make sure that the correct environment is selected. 13 Use the search bar to nd the library you are looking for, select it and click "Install Package". 3.3 pip This sould be your last resort but it is likely that you will have to use it at some point. This is the raw python installer and it can be used to install libraries that are not listed in the anaconda distribution package. To install a library using pip, we need to use the command line. If you are using Windows: 1. Open the Anaconda Prompt 2. Run activate [environment name] 3. Run "pip install [library name]" If you are using Mac: 1. Open the Terminal 2. Run source activate [environment name] 3. Run "pip install [library name]" Let us take "pykalman" as an example. This library implements of the Kalman Filter but it is not listed in anaconda. Now the pykalman library is installed your environment and can be used in PyCharm or Jupyter. 14 4 Installing the Bloomberg API The Bloomberg python library (blpapi) is not listed in the anaconda distribution system so we have to install it manually. For this Bloomberg API setup, you must already have Anaconda and PyCharm installed on your computer and have access to a Bloomberg terminal. Download the wheel installer from the following address and take note of the folder where you saved the le: https://bintray.com/bloomberg/BLPAPI-Experimental-pip/download_le?le_path=simple%2Fblpapi%2Fblpapi3.9.1-cp36-cp36m-win_amd64.whl Assuming you are using a windows computer, open the Anaconda prompt, activate your python 3.6 environment by running the command conda activatewhere is the name of the environment. Run the command pip install <le_path>, where <le_path> is the address of the wheel installer you downloaded. Now the bloomberg API is installed to your environment. 15
Source Exif Data:
File Type : PDF File Type Extension : pdf MIME Type : application/pdf PDF Version : 1.5 Linearized : Yes Author : Create Date : 2019:05:05 23:05:41-02:00 Modify Date : 2019:05:05 23:06:35-02:00 PTEX Fullbanner : This is MiKTeX-pdfTeX 2.9.6668 (1.40.19) Subject : XMP Toolkit : Adobe XMP Core 5.6-c016 91.163616, 2018/10/29-16:58:49 Format : application/pdf Creator : Description : Title : Creator Tool : LaTeX with hyperref Metadata Date : 2019:05:05 23:06:35-02:00 Keywords : Producer : pdfTeX-1.40.19 Trapped : False PTEX Fullbanner : This is MiKTeX-pdfTeX 2.9.6668 (1.40.19) Document ID : uuid:ff3bf834-1f7f-4d3e-8a31-6533b0095800 Instance ID : uuid:719fb525-6c9c-46ed-bb69-04b7e352acc7 Page Mode : UseOutlines Page Count : 15EXIF Metadata provided by EXIF.tools