I have Python version 2.7 installed in my system, which is Windows OS 64 bit.
I installed pyserial, from the page: https://pypi.python.org/pypi/pyserial
Now, the issue is that I am getting an error:
C:\rk\Python27\pythonprograms>python
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.
When I import other packages, they are getting imported successfully:
>>> import numpy
>>>
Also, if I import pyserial in the directory "C:\rk\Python27\python":
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
>>>
What's the reason and how to fix this issue?
Kindly help, Thanks.
Issue resolved.
I was opening Python exe as the 32 bit one, where as I had installed Python 2.7 for 64 bit with an amd extension.
I installed the python version recently, but, forgot to change the old compiler.
Related
I've installed wine on Ubuntu, python2.7 and pyqt4 install. But when I try to import pyqt4, it shows the error :
john#Ubuntu-python:~/.wine$ wine python
Python 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:42:59) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from PyQt4.QtCore import *
err:module:import_dll Library python34.dll (which is needed by L"C:\\Python27\\lib\\site-packages\\PyQt4\\QtCore.pyd") not found
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: DLL load failed: Module not found.
I'm on Windows 10 and have installed Anaconda3 (2016-1). When I use Spyder that Anaconda installed, import pandas works.
From PyCharm I however can't import pandas. PyCharm is set to use C:\Users\Chris>C:\Users\Chris\Anaconda3\envs\Conda\python.exe.
If I call the exe directly I also can't import pandas despite it being in the Anaconda3 dictionary.
C:\Users\Chris>C:\Users\Chris\Anaconda3\envs\Conda\python.exe
Python 3.5.1 |Continuum Analytics, Inc.| (default, Feb 16 2016, 09:49:46) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pandas
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'pandas'
What do I have to do, that I can import pandas?
It works when I set the path to C:\Users\Chris>C:\Users\Chris\Anaconda3\python.exe instead of using a virtual enviroment with C:\Users\Chris>C:\Users\Chris\Anaconda3\envs\Conda\python.exe as PyCharm suggests.
I had download pandas from this link
Then I unzipped the pandas file in site-packages and run the python setup.py command.
import pandas work fine in the directory where it is installed
C:\Python27\ArcGIS10.3\Lib\site-packages\pandas-0.17.1>python
Python 2.7.8 (default, Jun 30 2014, 16:03:49) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pandas
>>>
Once am out of the directory pandas-0.17.1, import pandas gives following results:
C:\Python27\ArcGIS10.3\Lib\site-packages>python
Python 2.7.8 (default, Jun 30 2014, 16:03:49) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pandas
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named pandas
>>>
Why is it so?
you should add PYTHONPATH in your shell like this on windows.
set PYTHONPATH=%PYTHONPATH%;C:\Python27\ArcGIS10.3\Lib\site-packages\pandas-0.17.1
It runs on windows 8.1 64 bit machine, I have installed python 2.7.8 and numpy 1.5.1 (earlier had 1.9.1) and openCV 2.4.10. I got this error referred other blogspots, stackoverflow previous questions but couldn't get the right results. I think it has something to do with 64/32 bit version compatibility please help me out!!!
command line:
C:\Users\Shivakumar>python
Python 2.7.8 (default, Jun 30 2014, 16:03:49) [MSC v.1500 32 bit (Intel)] on win 32
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
>>> import cv2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: DLL load failed: %1 is not a valid Win32 application.
>>>
When I try to import pylons in the virtual python environment I get the error
C:\env\Scripts>python
Python 2.7 (r27:82525, Jul 4 2010, 07:43:08) [MSC v.1500 64 bit (A
MD64)] on win32
Type "help", "copyright", "credits" or "license" for more informati
on.
>>> import pylons
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\env\lib\site-packages\pylons-1.0-py2.7.egg\pylons\__init
__.py", line 6, in <module>
from paste.registry import StackedObjectProxy
ImportError: No module named registry
As I understand this error, Python is telling me that it can not find the module named registry. Perhaps this is a result of the error I got while installing Pylons which is explained over here Why do I get an error on the last line of installing Pylons 1.0 with easy_install and Python 2.7 in Windows Vista 64?
It seems that many of the Pylon components were installed but I guess registry was not or maybe Pylons just can not see it.
Any ideas on how to solve this?
You have to activate the virtual environment before you can import pylons.
C:\Users\Josh>env\scripts\activate
(env) C:\Users\Josh>python
ActivePython 2.6.2.2 (ActiveState Software Inc.) based on
Python 2.6.2 (r262:71600, Apr 21 2009, 15:05:37) [MSC v.1500 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pylons
>>>
vs. this
C:\Users\Josh\env\Scripts>python
ActivePython 2.6.2.2 (ActiveState Software Inc.) based on
Python 2.6.2 (r262:71600, Apr 21 2009, 15:05:37) [MSC v.1500 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> pylons
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'pylons' is not defined
>>>
I guessing that you have the pylons package installed outside and inside your virtual environment. So python is letting you import pylons but the paste package is not installed outside of your virtual environment so you are getting an error.
Running the activate batch script (should be inside your env\Scripts folder) should solve the problem.