You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+28-2Lines changed: 28 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -35,6 +35,16 @@ To [install python modules](https://packaging.python.org/tutorials/packaging-pro
35
35
python3 -m pip install --upgrade setuptools wheel
36
36
```
37
37
38
+
IMPORTANT: many errors will be avoided by specifying the `-vm` option to gopy, with a full path if needed, or typically just `-vm=python3` to use python3 instead of version 2, which is often the default for the plain `python` command.
39
+
40
+
### Linux
41
+
42
+
On linux, you may need to ensure that the linker `ld` will look in the current directory for library files -- add this to your `.bashrc` file (and `source` that file after editing, or enter command locally):
43
+
44
+
```sh
45
+
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:.
46
+
```
47
+
38
48
### Windows
39
49
40
50
As of version 0.4.0, windows is now better supported, and is passing tests (on at least one developers machine). You may still need to set some environment variables depending on your python installation, but a vanilla standard install is working.
@@ -63,6 +73,8 @@ Documentation is available on [godoc](https://godoc.org):
63
73
64
74
The `pkg` and `exe` commands are for end-users and create a full standalone python package that can be installed locally using `make install` based on the auto-generated `Makefile`. Theoretically these packages could be uploaded to https://pypi.org/ for wider distribution, but that would require a lot more work to handle all the different possible python versions and coordination with the Go source version, so it is much better to just do the local make install on your system. The `gen` and `build` commands are used for testing and just generate / build the raw binding files only.
65
75
76
+
IMPORTANT: many errors will be avoided by specifying the `-vm` option to gopy, with a full path if needed, or typically just `-vm=python3` to use python3 instead of version 2, which is often the default for the plain `python` command.
77
+
66
78
Here are some (slightly enhanced) docs from the help command:
@@ -244,12 +254,28 @@ To know what features are supported on what backends, please refer to the
244
254
245
255
## Troubleshooting
246
256
257
+
### python version mismatches
258
+
259
+
Many errors will be avoided by specifying the `-vm` option to gopy, with a full path if needed, or typically just `-vm=python3` to use python3 instead of version 2, which is often the default for the plain `python` command.
260
+
261
+
If you get any kind of error about the library module not being able to be imported, or apparently a large number of other random-looking errors, a mismatch between the python version used for compiling vs. what you are using to run is the most likely explanation.
262
+
247
263
If you get an error like this after importing a generated module:
248
264
```bash
249
265
Fatal Python error: _PyInterpreterState_Get(): no current thread state
250
266
```
251
267
it means you are running a different version of python than the one that build the library you are importing -- make sure you've got the paths in your `-vm` arg aligned with what you are using to import.
252
268
269
+
### linux: cannot find .so file
270
+
271
+
If your `import` statement fails to find the module `.so` file, and it is in the current directory, you may need to ensure that the linker `ld` will look in the current directory for library files -- add this to your `.bashrc` file (and `source` that file after editing, or enter command locally):
272
+
273
+
```sh
274
+
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:.
275
+
```
276
+
277
+
you may also need to add your python path, but that is less likely to be an issue.
278
+
253
279
## Contribute
254
280
255
281
`gopy` is part of the `go-python` organization and licensed under `BSD-3`.
0 commit comments