@@ -20,8 +20,8 @@ GNU/Linux distributions.
20
20
You will need to install PyCall in your existing Julia installation
21
21
22
22
``` 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" )
25
25
```
26
26
27
27
Your python installation must be able to call Julia. If your installer
@@ -36,32 +36,32 @@ with the following installation steps, we recommend to have a look at
36
36
37
37
To get released versions you can use:
38
38
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
42
42
```
43
43
44
44
where ` --user ` should be omitted if you are using virtual environment
45
45
(` virtualenv ` , ` venv ` , ` conda ` , etc.).
46
46
47
47
If you are interested in using the development version:
48
48
49
- ``` sh
50
- python3 -m pip install --user ' https://github.com/JuliaPy/pyjulia/archive/master.zip#egg=julia'
49
+ ``` console
50
+ $ python3 -m pip install --user ' https://github.com/JuliaPy/pyjulia/archive/master.zip#egg=julia'
51
51
```
52
52
53
53
You may clone it directly to your home directory.
54
54
55
- ```
56
- git clone https://github.com/JuliaPy/pyjulia
55
+ ``` console
56
+ $ git clone https://github.com/JuliaPy/pyjulia
57
57
```
58
58
59
59
then inside the pyjulia directory you need to run the python setup file
60
60
61
- ```
62
- cd pyjulia
63
- python3 -m pip install --user .
64
- python3 -m pip install --user -e . # If you want "development install"
61
+ ``` console
62
+ $ cd pyjulia
63
+ $ python3 -m pip install --user .
64
+ $ python3 -m pip install --user -e . # If you want "development install"
65
65
```
66
66
67
67
The ` -e ` flag makes a development install, meaning that any change to pyjulia
@@ -82,42 +82,42 @@ which can be used in a customized setup.
82
82
To call a Julia function in a Julia module, import the Julia module
83
83
(say ` Base ` ) with:
84
84
85
- ``` python
86
- from julia import Base
85
+ ``` pycon
86
+ >>> from julia import Base
87
87
```
88
88
89
89
and then call Julia functions in ` Base ` from python, e.g.,
90
90
91
- ``` python
92
- Base.sind(90 )
91
+ ``` pycon
92
+ >>> Base.sind(90 )
93
93
```
94
94
95
95
Other variants of Python import syntax also work:
96
96
97
- ``` python
98
- import julia.Base
99
- from julia.Base import LinAlg # import a submodule
100
- from julia.Base import sin # import a function from a module
97
+ ``` pycon
98
+ >>> import julia.Base
99
+ >>> from julia.Base import LinAlg # import a submodule
100
+ >>> from julia.Base import sin # import a function from a module
101
101
```
102
102
103
103
The global namespace of Julia's interpreter can be accessed via a
104
104
special module ` julia.Main ` :
105
105
106
- ``` python
107
- from julia import Main
106
+ ``` pycon
107
+ >>> from julia import Main
108
108
```
109
109
110
110
You can set names in this module to send Python values to Julia:
111
111
112
- ``` python
113
- Main.xs = [1 , 2 , 3 ]
112
+ ``` pycon
113
+ >>> Main.xs = [1 , 2 , 3 ]
114
114
```
115
115
116
116
which allows it to be accessed directly from Julia code, e.g., it can
117
117
be evaluated at Julia side using Julia syntax:
118
118
119
- ``` python
120
- Main.eval(" sin.(xs)" )
119
+ ``` pycon
120
+ >>> Main.eval(" sin.(xs)" )
121
121
```
122
122
123
123
### Low-level interface
@@ -126,15 +126,15 @@ If you need a custom setup for `pyjulia`, it must be done *before*
126
126
importing any Julia modules. For example, to use the Julia
127
127
executable named ` custom_julia ` , run:
128
128
129
- ``` python
130
- from julia import Julia
131
- jl = julia.Julia(runtime = " custom_julia" )
129
+ ``` pycon
130
+ >>> from julia import Julia
131
+ >>> jl = julia.Julia(runtime = " custom_julia" )
132
132
```
133
133
134
134
You can then use, e.g.,
135
135
136
- ``` python
137
- from julia import Base
136
+ ``` pycon
137
+ >>> from julia import Base
138
138
```
139
139
140
140
0 commit comments