User Tools

Site Tools


script:python

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
script:python [2020/02/26 17:22] – [Create execute file exe to run on windows] adminscript:python [2023/11/28 09:35] – [The try-except clause] admin
Line 137: Line 137:
 </code> </code>
 Windows: download and install it from http://conda.pydata.org/miniconda.html(Win32, not 64bits) Windows: download and install it from http://conda.pydata.org/miniconda.html(Win32, not 64bits)
 +
 +After install, change the PATH of python to PATH of conda
 === Basic Create virtual enviornment with conda === === Basic Create virtual enviornment with conda ===
   * Help options in Creating environment:<code bash>   * Help options in Creating environment:<code bash>
Line 208: Line 210:
 </code> </code>
 === Create virtual environment for zipline app and using it === === Create virtual environment for zipline app and using it ===
-We will install **zipline** which requirement package **numpy**:+We will install **zipline** which requirement package **numpy** (Because we can found **numpy** in packages of conda on **https://anaconda.org/anaconda/repo**):
   - Step1: Create new virtual environment with name **zipline** which contain package **numpy** in conda<code bat>   - Step1: Create new virtual environment with name **zipline** which contain package **numpy** in conda<code bat>
 conda create -n zipline numpy conda create -n zipline numpy
-</code> => You click yes to install these packages for new virtual environment+</code> => (option **-n -> --name** of environment)You click yes to install these packages for new virtual environment. You can check new environment created in directory<code> 
 +D:\tools\miniconda2\envs\ 
 +</code>
   - Step2: Go to virtual environment zipline:<code>   - Step2: Go to virtual environment zipline:<code>
 source activate zipline source activate zipline
 +</code>in Windows, go to directory **d:\tools\Miniconda2\condabin\** and run command below<code>
 +conda.bat activate zipline
 </code> </code>
   - Step3: Install zipline in environment:<code>   - Step3: Install zipline in environment:<code>
 conda install -c Quantopian zipline conda install -c Quantopian zipline
-</code>+</code> =>install package **zipline** from channel **Quantopian** on **https://anaconda.org/anaconda/repo**{{:script:screen_shot_2020-11-26_at_4.58.01_pm.png|}}
 === Other commands of conda === === Other commands of conda ===
   * List environments in conda<code bat>   * List environments in conda<code bat>
Line 229: Line 235:
   * Remove environment in conda:<code bat>   * Remove environment in conda:<code bat>
 conda env remove -n zipline conda env remove -n zipline
-</code> +</code>(option **-n -> --name** of environment) 
-==== anaconda ====+  * Install packages in environment https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-pkgs.html#installing-packages 
 +==== Anaconda ====
 install anaconda:<code> install anaconda:<code>
 conda install anaconda conda install anaconda
 </code> </code>
-===== Build python modules from source =====+==== Build python modules from source ====
   - Step1: Download source and go to source directory and run<code bat>   - Step1: Download source and go to source directory and run<code bat>
 pip install -r requirements.txt pip install -r requirements.txt
Line 1100: Line 1107:
 else: else:
    If there is no exception then execute this block.     If there is no exception then execute this block. 
 +</code>
 +<code python>
 +try:
 +   You do your operations here;
 +   ......................
 +except:
 +   If there is any exception, then execute this block.
 +   ......................
 </code> </code>
   * The except clause with multiple exceptions<code python>   * The except clause with multiple exceptions<code python>
script/python.txt · Last modified: 2023/11/28 09:35 by admin