Ubuntu12.04 自安装python3.3中头文件Python.h路径:usr/local/python3.3/include/python3.3m
Ubuntu12.04 自带的Python2.7中头文件Python.h路径:usr/ include/python2.7
Ubuntu12.04 自安装python3.3解释器Python路径:usr/local/python3.3/bin
Ubuntu12.04 自带的Python2.7解释器Python路径:usr/ bin
但默认解释器是python2.7,所以无论在哪个目录下输入python都是python2.7(可能是在安装python3.3时建立了连接关系)
现在将python备份:sudo cp /usr/bin/python ./pythonback
删除原python:sudo rm usr/bin/python
建立新连接 sudo ln -s /usr/local/python3.3/bin/python3.3 /usr/bin/python
之后输入python默认的就是python3.3解释器了,如果想使用python2.7可以在/usr/bin目录下使用pythonback
如果不想更改默认连接,则可以在/usr/local/python3.3/bin目录下使用python3.3
spi源文件名:spi.c
编译:
gcc -fpic -c -I/usr/local/python3.3/include/python3.3m spi.c =>spi.o(用Python3.3的头文件python.h)
gcc -shared -o spi.so spi.o =>spi.so(产生共享库spi.so文件)
测试文件名:spi_test.py
原文地址:http://www.cnblogs.com/cj2014/p/3717623.html