我的系统中安装了Python版本2.7,即Windows OS 64位。
我从页面https://pypi.python.org/pypi/pyserial
安装了pyserial现在,问题是我收到了错误:
C:\ RK \ Python27 \ pythonprograms>蟒
Python 2.7.5 (default, May 15 2013, 22:43:36) [MSC v.1500 32 bit (I
32
Type "help", "copyright", "credits" or "license" for more informati
>>> import serial
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\rk\Python27\lib\site-packages\serial\__init__.py", line
e>
from serial.serialwin32 import *
File "C:\rk\Python27\lib\site-packages\serial\serialwin32.py", li
dule>
import ctypes
File "C:\rk\Python27\lib\ctypes\__init__.py", line 10, in <module
from _ctypes import Union, Structure, Array
ImportError: DLL load failed: %1 is not a valid Win32 application.
当我导入其他包时,它们会成功导入:
>>> import numpy
>>>
另外,如果我在目录"C:\rk\Python27\python"
中导入pyserial:
C:\rk\Python27>python
Python 2.7 (r27:82525, Jul 4 2010, 07:43:08) [MSC v.1500 64 bit (AMD64)] on win
32
Type "help", "copyright", "credits" or "license" for more information.
>>> import serial
>>>
是什么原因以及如何解决这个问题?
请帮助,谢谢。
答案 0 :(得分:0)
问题已解决。
我打开Python exe作为32位,因为我安装了Python 2.7 for 64 bit with amd extension。
我最近安装了python版本,但是,忘了更改旧的编译器。