@@ -20,8 +20,8 @@ GNU/Linux distributions.
2020You will need to install PyCall in your existing Julia installation
2121
2222``` julia
23- using Pkg # for julia ≥ 0.7
24- Pkg. add (" PyCall" )
23+ julia > using Pkg # for julia ≥ 0.7
24+ julia > Pkg. add (" PyCall" )
2525```
2626
2727Your python installation must be able to call Julia. If your installer
@@ -36,9 +36,9 @@ with the following installation steps, we recommend to go through
3636
3737To get released versions you can use:
3838
39- ``` sh
40- python3 -m pip install --user julia
41- python2 -m pip install --user julia # If you need Python 2
39+ ``` console
40+ $ python3 -m pip install --user julia
41+ $ python2 -m pip install --user julia # If you need Python 2
4242```
4343
4444where ` --user ` should be omitted if you are using virtual environment
@@ -47,22 +47,22 @@ where `--user` should be omitted if you are using virtual environment
4747If you are interested in using the development version, you can
4848install PyJulia directly from GitHub:
4949
50- ``` sh
51- python3 -m pip install --user ' https://github.com/JuliaPy/pyjulia/archive/master.zip#egg=julia'
50+ ``` console
51+ $ python3 -m pip install --user ' https://github.com/JuliaPy/pyjulia/archive/master.zip#egg=julia'
5252```
5353
5454You may clone it directly to your home directory.
5555
56- ```
57- git clone https://github.com/JuliaPy/pyjulia
56+ ``` console
57+ $ git clone https://github.com/JuliaPy/pyjulia
5858```
5959
6060then inside the pyjulia directory you need to run the python setup file
6161
62- ```
63- cd pyjulia
64- python3 -m pip install --user .
65- python3 -m pip install --user -e . # If you want "development install"
62+ ``` console
63+ $ cd pyjulia
64+ $ python3 -m pip install --user .
65+ $ python3 -m pip install --user -e . # If you want "development install"
6666```
6767
6868The ` -e ` flag makes a development install, meaning that any change to pyjulia
@@ -83,42 +83,42 @@ which can be used in a customized setup.
8383To call a Julia function in a Julia module, import the Julia module
8484(say ` Base ` ) with:
8585
86- ``` python
87- from julia import Base
86+ ``` pycon
87+ >>> from julia import Base
8888```
8989
9090and then call Julia functions in ` Base ` from python, e.g.,
9191
92- ``` python
93- Base.sind(90 )
92+ ``` pycon
93+ >>> Base.sind(90 )
9494```
9595
9696Other variants of Python import syntax also work:
9797
98- ``` python
99- import julia.Base
100- from julia.Base import LinAlg # import a submodule
101- from julia.Base import sin # import a function from a module
98+ ``` pycon
99+ >>> import julia.Base
100+ >>> from julia.Base import LinAlg # import a submodule
101+ >>> from julia.Base import sin # import a function from a module
102102```
103103
104104The global namespace of Julia's interpreter can be accessed via a
105105special module ` julia.Main ` :
106106
107- ``` python
108- from julia import Main
107+ ``` pycon
108+ >>> from julia import Main
109109```
110110
111111You can set names in this module to send Python values to Julia:
112112
113- ``` python
114- Main.xs = [1 , 2 , 3 ]
113+ ``` pycon
114+ >>> Main.xs = [1 , 2 , 3 ]
115115```
116116
117117which allows it to be accessed directly from Julia code, e.g., it can
118118be evaluated at Julia side using Julia syntax:
119119
120- ``` python
121- Main.eval(" sin.(xs)" )
120+ ``` pycon
121+ >>> Main.eval(" sin.(xs)" )
122122```
123123
124124### Low-level interface
@@ -127,15 +127,15 @@ If you need a custom setup for `pyjulia`, it must be done *before*
127127importing any Julia modules. For example, to use the Julia
128128executable named ` custom_julia ` , run:
129129
130- ``` python
131- from julia import Julia
132- jl = julia.Julia(runtime = " custom_julia" )
130+ ``` pycon
131+ >>> from julia import Julia
132+ >>> jl = julia.Julia(runtime = " custom_julia" )
133133```
134134
135135You can then use, e.g.,
136136
137- ``` python
138- from julia import Base
137+ ``` pycon
138+ >>> from julia import Base
139139```
140140
141141
0 commit comments