Skip to content

Commit a681365

Browse files
committed
[09/26/2022] 在Windows下编译matplotlib-cpp
在Windows下编译matplotlib-cpp
1 parent 91fb917 commit a681365

File tree

1 file changed

+12
-19
lines changed

1 file changed

+12
-19
lines changed

README.md

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,18 @@ matplotlib-cpp
44
Welcome to matplotlib-cpp, possibly the simplest C++ plotting library.
55
It is built to resemble the plotting API used by Matlab and matplotlib.
66

7+
## 编译matplotlib-cpp
78

9+
### Windows
10+
11+
```bash
12+
mkdir build
13+
cd build
14+
cmake .. -G "Visual Studio 15 2017 Win64" -DCMAKE_INSTALL_PREFIX=..\dist
15+
%comspec% /k "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat"
16+
msbuild /maxcpucount:4 /p:Configuration=Release /p:PreferredToolArchitecture=x64 ALL_BUILD.vcxproj
17+
msbuild /maxcpucount:4 /p:Configuration=Release /p:PreferredToolArchitecture=x64 INSTALL.vcxproj
18+
```
819

920
Usage
1021
-----
@@ -17,25 +28,7 @@ int main() {
1728
plt::show();
1829
}
1930
```
20-
**一般方式编译**
21-
22-
```bash
23-
g++ minimal.cpp -std=c++11 -I/usr/include/python2.7 -lpython2.7 -o minimal
24-
```
25-
26-
**Anaconda方式编译**
27-
28-
```bash
29-
g++ minimal.cpp \
30-
-std=c++11 \
31-
-I${CONDA_PREFIX}/include/python3.7m \
32-
-I${CONDA_PREFIX}/lib/python3.7/site-packages/numpy/core/include \
33-
-L${CONDA_PREFIX}/lib
34-
-lpython3.7m \
35-
-o minimal
36-
```
37-
38-
如果是`python3.8`,那么相关地方修改成`3.8`即可。在运行的时候,必须把`libpython3.7m.so`的目录放在`LD_LIBRARY_PATH`中,否则`mininal`程序无法运行。
31+
g++ minimal.cpp -std=c++11 -I/usr/include/python2.7 -lpython2.7
3932
4033
**Result:**
4134

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy