4
4
< style type ="text/css "> <!- -
5
5
6
6
body {
7
- font: 8pt / 16pt geor gia, verdana;
7
+ font: 12pt / 18pt geor gia, verdana;
8
8
text- decor ation: none;
9
9
color : # 555753;
10
10
background: # ffffff ;
11
11
margin: 0px;
12
12
}
13
13
14
14
p {
15
- font : 8 pt/16pt georgia;
15
+ font : 12 pt/18pt georgia;
16
16
}
17
17
18
18
h1 {
19
- font : bold 14 pt ;
19
+ font : bold 16 pt ;
20
20
color : # 000044 ;
21
21
/*
22
22
background-color: #EFEFFF;
68
68
}
69
69
70
70
li {
71
- font : 8 pt/16pt georgia, verdana;
71
+ font : 12 pt/18pt georgia, verdana;
72
72
text-decoration : none;
73
73
color : # 555753 ;
74
74
}
75
75
76
76
.spacer {
77
- font : bold 14 pt ;
77
+ font : bold 16 pt ;
78
78
}
79
79
80
80
.menu {
@@ -122,71 +122,63 @@ <h1>Python for .NET</h1>
122
122
</ ul >
123
123
</ td >
124
124
< td align ="left " valign ="top ">
125
- < p > Python for .NET is a package that gives Python programmers
126
- nearly seamless integration with the .NET Common Language Runtime
127
- (CLR) and provides a powerful application scripting tool for .NET
125
+ < p > Python for .NET (pythonnet) is a package that gives Python programmers
126
+ nearly seamless integration with the .NET 4.0+ Common Language Runtime
127
+ (CLR) on Windows and Mono runtime on Linux and OSX.
128
+ Python for .NET provides a powerful application scripting tool for .NET
128
129
developers. Using this package you can script .NET applications or
129
130
build entire applications in Python, using .NET services and
130
- components written in any language that targets the CLR (Managed
131
- C++, C#, VB, JScript).
131
+ components written in any language that targets the CLR (C#, VB.NET, F#, C++/CLI).
132
132
</ p >
133
133
< p > Note that this package does < em > not</ em > implement Python as a
134
134
first-class CLR language - it does not produce managed code (IL)
135
- from Python code. Rather, it is an integration of the C Python
136
- engine with the .NET runtime. This approach allows you to use use
137
- CLR services and continue to use existing Python code and C-based
135
+ from Python code. Rather, it is an integration of the CPython
136
+ engine with the .NET or Mono runtime. This approach allows you to use use
137
+ CLR services and continue to use existing Python code and C-API
138
138
extensions while maintaining native execution speeds for Python
139
139
code. If you are interested in a pure managed-code implementation
140
140
of the Python language, you should check out the < a href ="http://www.ironpython.com "> IronPython</ a >
141
141
project, which is in active development.
142
142
</ p >
143
- < p > Python for .NET is currently compatible with Python releases 2.3
144
- and greater. Current releases are available at the < a href ="http://pythonnet.github.io/ ">
143
+ < p > Python for .NET is currently compatible with Python releases 2.7, 3.3, 3.4, and 3.5.
144
+ Current releases are available at the < a href ="http://pythonnet.github.io/ ">
145
145
Python for .NET website </ a > . To subscribe to the < a href ="http://mail.python.org/mailman/listinfo/pythondotnet ">
146
146
Python for .NET mailing list </ a > or read the < a href ="http://mail.python.org/pipermail/pythondotnet/ ">
147
147
online archives </ a > of the list, see the < a href ="http://mail.python.org/mailman/listinfo/pythondotnet ">
148
148
mailing list information </ a > page. </ p >
149
149
< a name ="#installation "> </ a >
150
150
< h2 > Installation</ h2 >
151
- < p > Python for .NET is available as a source release and as a
152
- Windows installer for various versions of Python and the common
153
- language runtime from the < a href ="http://pythonnet.github.io/ ">
154
- Python for .NET website </ a > . On Windows platforms, you can
155
- choose to install .NET-awareness into an existing Python
156
- installation as well as install Python for .NET as a standalone
157
- package.
151
+ < p > Python for .NET is available as a source release on
152
+ < a href ="https://github.com/pythonnet/pythonnet/releases "> GitHub </ a >
153
+ and as a binary wheel distribution for all supported versions of Python
154
+ and the common language runtime from the < a href ="https://pypi.python.org/pypi/pythonnet ">
155
+ Python Package Index </ a > .
158
156
</ p >
159
157
160
158
< p > The source release is a self-contained "private" assembly. Just
161
- unzip the package wherever you want it, cd to that directory and
162
- run python.exe to start using it. Note that the source release
163
- does not include a copy of the CPython runtime, so you will need
164
- to have installed Python on your machine before using the source
165
- release.
166
- </ p >
167
- < p > < strong > Running on Linux/Mono:</ strong > preliminary testing
159
+ unzip the package wherever you want it, cd to that directory,
160
+ build the solution < strong > python setup.py build_ext --inplace</ strong > .
161
+ Once you start up Python or IPython interpreter in this directory or
162
+ append this directory to < strong > sys.path</ strong > ,
163
+ then after < strong > import clr</ strong > statement .NET assemblies can be used.
164
+ You can also run npython.exe to check how python can be embedded
165
+ in console .NET application.
166
+ Note that the source release does not include a copy of the CPython runtime,
167
+ so you will need to have installed Python on your machine before using
168
+ the source release.
169
+ </ p >
170
+ < p > < strong > Running on Linux/Mono:</ strong > Unit testing
168
171
shows that PythonNet will run under < a href ="http://www.go-mono.com "> Mono</ a > ,
169
- though the Mono runtime is not yet complete so there still may be
170
- problems. The Python for .NET integration layer is 100% managed
171
- code, so there should be no long-term issues under Mono - it
172
- should work better and better as the Mono platform matures.
173
- </ p >
174
- < p > Note that if you are running under Mono on a *nix system, you
175
- will need to have a compatible version of Python installed. You
176
- will also need to create a symbolic link to the copy of
177
- libpython2.x.so (in your existing Python installation) in the
178
- PythonNet directory. This is needed to ensure that the mono
179
- interop dll loader will find it by name. For example:
180
- </ p >
181
- < pre > ln -s /usr/lib/libpython2.4.so ./python24.so
182
- </ pre >
172
+ though the Mono runtime is less supported so there still may be
173
+ problems.
174
+ </ p >
183
175
< a name ="getting_started "> </ a >
184
176
< h2 > Getting Started</ h2 >
185
177
< p > A key goal for this project has been that Python for .NET should
186
178
"work just the way you'd expect in Python", except for cases that
187
179
are .NET specific (in which case the goal is to work "just the way
188
180
you'd expect in C#"). In addition, with the IronPython project
189
- gaining traction , it is my goal that code written for IronPython
181
+ having established a community , it is my goal that code written for IronPython
190
182
run without modification under Python for .NET.
191
183
</ p >
192
184
< p > If you already know Python, you can probably finish this readme
@@ -195,18 +187,13 @@ <h2>Getting Started</h2>
195
187
you probably just need to pick up one of the many good Python
196
188
books or read the Python tutorial online to get started.
197
189
</ p >
198
- < p > A good way to start is to run < strong > python.exe</ strong > and
199
- follow along with the examples in this document. If you get stuck,
190
+ < p > A good way to start is to interactively explore
191
+ .NET usage in python interpreter by
192
+ following along with the examples in this document. If you get stuck,
200
193
there are also a number of demos and unit tests located in the
201
194
source directory of the distribution that can be helpful as
202
195
examples.
203
196
</ p >
204
- < p > Note that if you have installed CLR support into your existing
205
- Python installation (rather than using the included python.exe),
206
- you will need to use the line: "'import clr" (lower-case!) to
207
- initially load the clr extension module before trying the
208
- following examples.
209
- </ p >
210
197
< a name ="importing "> </ a >
211
198
< h2 > Importing Modules</ h2 >
212
199
< p > Python for .NET allows CLR namespaces to be treated essentially
@@ -216,16 +203,6 @@ <h2>Importing Modules</h2>
216
203
< pre > from System import String
217
204
from System.Collections import *
218
205
</ pre >
219
- < p >
220
- < em > Note that earlier releases of Python for .NET required you to
221
- import modules through a special top-level package named < code > CLR</ code > .
222
- This is no longer required if you are starting python from the
223
- managed python.exe from this distribution.< br >
224
- < code > CLR</ code > has been deprecated in favor of the more
225
- pythonic < code > clr</ code > , though the syntax is still supported
226
- for backward compatibility.
227
- </ em >
228
- </ p >
229
206
< p > Types from any loaded assembly may be imported and used in this
230
207
manner. To load an assembly, use the "AddReference" function in
231
208
the "clr" module:
@@ -276,8 +253,7 @@ <h2>Using Classes</h2>
276
253
</ pre >
277
254
< a name ="generics "> </ a >
278
255
< h2 > Using Generics</ h2 >
279
- < p > When running under versions of the .NET runtime greater than
280
- 2.0, you can use generic types. A generic type must be bound to
256
+ < p > Pythonnet also supports generic types. A generic type must be bound to
281
257
create a concrete type before it can be instantiated. Generic
282
258
types support the subscript syntax to create bound types:
283
259
</ p >
0 commit comments