python3.6借助vs2017扩展c

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/songqiu65/article/details/68945078

环境:win10+vs2017+python3.6 32位
1.安装vs2017组件:
c++桌面开发和python包(3.6版本)和python本机开发工具**
这里写图片描述
2.添加环境变量
名称:PythonHome
填入:python3.6的地址(默认为:C:\Program Files (x86)\Python36-32)
3.vs2017新建python扩展模块(位于visual c++里面的python)(没有就说明该模块没有安装)
4.运行报“module1.vcxproj(194,5): error : Python development files are not installed. Please add the development files, or repair your existing installation.”
通过查看.vcxproj文件,发现是未获取到python版本号。
解决办法:打开.vcxproj文件,将PythonVersion的值改为3.6(直接ctrl+f搜索PythonVersion,默认值为3.5)
5.idle导入模块
import module1

6.模块位置:当前项目下的debug文件里

猜你喜欢

转载自blog.csdn.net/songqiu65/article/details/68945078