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
{{ message }}
This repository was archived by the owner on Oct 20, 2022. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+15-5
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Python Embedded Example Project
2
2
3
-
This is an example project using mebedded python 3.8 (cpython) in C++ console application using CMake. This example project also contains pybind11 library for easy binding between C++ and python.
3
+
This is an example project using mebedded **[python 3.8](https://github.com/python/cpython)** in C++ console application using CMake. This example project also contains **[pybind11](https://github.com/pybind/pybind11)** library for easy binding between C++ and python.
4
4
5
5
Tested on Windows 10 with Visual Studio 2013, 2015, and 2017 (both x86 and x64). Also tested on Ubuntu with GCC (x64).
6
6
@@ -37,13 +37,13 @@ Visual Studio 2013 (or newer) or Linux with GCC. MinGW is sadly not supported, a
37
37
38
38
## Download
39
39
40
-
Don't forget to initialise and update the submodules!
40
+
Don't forget to initialise and update the submodules! The cpython is +200MB so it may take some time to during `git submodule update`.
The `PythonEmbeddedExample` executable will be generated.
85
85
86
+
## Changing python version
87
+
88
+
At the time of the creation of this example, Python 3.8 was just released. The cpython submodule is frozen to commit `491bbedc209fea314a04cb3015da68fb0aa63238`. If you want to change python version, change the `branch` in `.gitmodules` to `branch = 2.7` or any other version. See available branches at: <https://github.com/python/cpython>
89
+
86
90
## Example output
87
91
88
92
Example output of the `PythonEmbeddedExample` executable.
@@ -92,4 +96,10 @@ Python PATH set to: C:\Users\matus\Documents\cpp\python-embedded-example-project
92
96
Importing module...Initializing class...
93
97
Example constructor with msg: Hello World
94
98
Got msg back on C++ side: Hello World
95
-
```
99
+
```
100
+
101
+
## fatal error LNK1104: cannot open file 'python38_d.lib'
102
+
103
+
This happens when you run cmake with `-DCMAKE_BUILD_TYPE=MinSizeRel` and you are compiling the solution in Visual Studio as Debug. Simply, in Visual Studio, change the configuration to the one used in `CMAKE_BUILD_TYPE`.
104
+
105
+
This happens because the cpython has been built via `CMAKE_BUILD_TYPE` but your Visual Studio is looking for a debug version of the python library (or the other way around).
0 commit comments