Title: Unable to compile examples on MacOS · Issue #361 · lava/matplotlib-cpp · GitHub
Open Graph Title: Unable to compile examples on MacOS · Issue #361 · lava/matplotlib-cpp
X Title: Unable to compile examples on MacOS · Issue #361 · lava/matplotlib-cpp
Description: fatal error: 'Python/Python.h' file not found I tried to add the file to my current project to plot some graph but couldn't make it to work. Please help me in this matter. There are 2 files matplotlibcpp.cpp and matplotlibcpp.h I downloa...
Open Graph Description: fatal error: 'Python/Python.h' file not found I tried to add the file to my current project to plot some graph but couldn't make it to work. Please help me in this matter. There are 2 files matplot...
X Description: fatal error: 'Python/Python.h' file not found I tried to add the file to my current project to plot some graph but couldn't make it to work. Please help me in this matter. There are 2 f...
Opengraph URL: https://github.com/lava/matplotlib-cpp/issues/361
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Unable to compile examples on MacOS","articleBody":"### fatal error: 'Python/Python.h' file not found\r\nI tried to add the file to my current project to plot some graph but couldn't make it to work. **Please help me in this matter.**\r\n\r\nThere are 2 files `matplotlibcpp.cpp` and `matplotlibcpp.h`\r\n\r\nI downloaded the `matplotlibcpp.h` file from this repo\r\n\r\nHere is the example file `matplotlibcpp.cpp` \r\n```cpp\r\n#include \"matplotlibcpp.h\"\r\n#include \u003ccmath\u003e\r\n\r\nnamespace plt = matplotlibcpp;\r\n\r\nint main()\r\n{\r\n // Prepare data.\r\n int n = 5000;\r\n std::vector\u003cdouble\u003e x(n), y(n), z(n), w(n,2);\r\n for(int i=0; i\u003cn; ++i) {\r\n x.at(i) = i*i;\r\n y.at(i) = sin(2*M_PI*i/360.0);\r\n z.at(i) = log(i);\r\n }\r\n\r\n // Set the size of output image to 1200x780 pixels\r\n plt::figure_size(1200, 780);\r\n // Plot line from given x and y data. Color is selected automatically.\r\n plt::plot(x, y);\r\n // Plot a red dashed line from given x and y data.\r\n plt::plot(x, w,\"r--\");\r\n // Plot a line whose name will show up as \"log(x)\" in the legend.\r\n plt::named_plot(\"log(x)\", x, z);\r\n // Set x-axis to interval [0,1000000]\r\n plt::xlim(0, 1000*1000);\r\n // Add graph title\r\n plt::title(\"Sample figure\");\r\n // Enable legend.\r\n plt::legend();\r\n // Save the image (file format is determined by the extension)\r\n plt::save(\"./basic.png\");\r\n}\r\n```\r\n\r\nI compile using \r\n```bash\r\ng++ matplotlibcpp.cpp -std=c++11 -I/opt/homebrew/opt/python@3.12/Frameworks/Python.framework/Versions/3.12/include/python3.12 -lpython3.12\r\n```\r\nand got this error\r\n```bash\r\nIn file included from matplotlibcpp.cpp:1:\r\n./matplotlibcpp.h:5:10: fatal error: 'Python/Python.h' file not found\r\n#include \u003cPython/Python.h\u003e\r\n ^~~~~~~~~~~~~~~~~\r\n1 error generated.\r\n```\r\n","author":{"url":"https://github.com/ngquyduc","@type":"Person","name":"ngquyduc"},"datePublished":"2024-06-05T07:12:46.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/361/matplotlib-cpp/issues/361"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:27d16908-1edf-b460-437a-ff7199fb348a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E81A:162063:27D1111:374A129:6977A9DD |
| html-safe-nonce | 9caa0bc5fbe44ce6a979f52eee733930837d6e9bfbf83acbf4ad39eea79fcc41 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFODFBOjE2MjA2MzoyN0QxMTExOjM3NEExMjk6Njk3N0E5REQiLCJ2aXNpdG9yX2lkIjoiNDExMjM5NTMxMTgyNzYyNjQ2MiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | d09a22c456a59047b008ccf72bba7cc9dea5605cc37a69b796228eda23e17190 |
| hovercard-subject-tag | issue:2335089116 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/lava/matplotlib-cpp/361/issue_layout |
| twitter:image | https://opengraph.githubassets.com/9956a2f60c86560840f2bad78c214a8d54134255aec34de3971e093425c11ac5/lava/matplotlib-cpp/issues/361 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/9956a2f60c86560840f2bad78c214a8d54134255aec34de3971e093425c11ac5/lava/matplotlib-cpp/issues/361 |
| og:image:alt | fatal error: 'Python/Python.h' file not found I tried to add the file to my current project to plot some graph but couldn't make it to work. Please help me in this matter. There are 2 files matplot... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ngquyduc |
| hostname | github.com |
| expected-hostname | github.com |
| None | e8b91803a5fc7ac066710509c57c636dab6ed4620bd9213b470a4617c79989c9 |
| turbo-cache-control | no-preview |
| go-import | github.com/lava/matplotlib-cpp git https://github.com/lava/matplotlib-cpp.git |
| octolytics-dimension-user_id | 51410 |
| octolytics-dimension-user_login | lava |
| octolytics-dimension-repository_id | 24936365 |
| octolytics-dimension-repository_nwo | lava/matplotlib-cpp |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 24936365 |
| octolytics-dimension-repository_network_root_nwo | lava/matplotlib-cpp |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 9b4562e3c5c60b38349a7d80ec8e160c11fe84b6 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width