Can't install pywin32..? - python

I tried to install pywin32 via the 32 bit python 2.6 msi installer and got this error:
I have no idea why, so I went and installed python 2.7 and tried again with the pywin32 2.7 installer and got an error that amounted to another error (Sorry for not being more specific, but python 2.7 is now gone from my computer. The error was incredibly vague and had "Error:" and then no more text after it if I recall correctly).
I can't figure out what this error means, however. I wanted to use pyinstaller but it requires pywin32, so after I couldn't install pywin32 I tried py2exe and got this error:
*** finding dlls needed ***
error: pywintypes26.dll: No such file or directory
So I'm pretty sure I need pywin32. Anyone have any ideas?

I don't know the cause, but I got the same error (only with different line numbers, maybe from a different version of pywin32), and this fix worked for me, installing on windows 7:
Extract the installer file to a directory using the free 7zip (or similar) program
Copy everything in the PLATLIB directory to C:\Python26\Lib\site-packages
Open a command prompt to the SCRIPT directory and type:
python pywin32_postinstall.py -install
You must have Python already installed (perhaps obviously) and in your windows PATH environment variable for this to work. You can also try the testall script in that PLATLIB directory (though for me, that hung). After doing this, I was able to import pywin32 modules from the Python IDLE just fine.
(Trying to run the installer in compatibility mode didn't solve this for me.)

I did the following and worked for version 2.7 (I did not try 3.0 and up, but it should work too):
Move the .exe file into the platlib (C:\Python27\Lib\site-packages)
Run as admin the .exe file and you should be Good :)
If you want to check if it worked just do: import win32api and run it.

As of when I wrote this (Feb'12), IMO Python 2.5 is the most stable version of Python on Windows. I suggest you try re-installing everything on Python 2.5. I use it on Windows 7 and I don't have any issues whatsoever

Related

Python Perforce module Error: No module named 'P4'

I got the P4 python module for win10 via the installer on their page: https://www.perforce.com/downloads/helix-core-api-python
Its for python 3.9, though I have tested it with both Python 3.10 and 3.9 and it always throws the error: No module named 'P4' when I try to use it inside visual code.
Interpreter is set up correctly (tried 310 and 39).
Im a bit lost here and would love some help.
The installer package installed the following files into site-packages:
P4.py
P4API.cp39-win_amd64.pyd
and a folder with 4 metadata files in it
P4.py on itself looks good, no errors.
Edit: Im trying to use it with Blender. Currently shipped python version within that is 3.10.2. Also tried a older blender version which uses 3.9.7.
Both wont work.
Visual studio code is known for it's bugs with python. You could try using "PyCharm". Make sure to install the modules from Pycharm's settings instead of terminal.
(I'm not sure if this is the reason, but it's worth the try. Had the same issue and the mentioned way solved it.)

SCons ImportError - No module named SCons.Script‏

I have been trying to get SCons working now for quite a time, but didn't succeed yet. Before everything else: I'm running Windows 7 x64.
I have firstly installed Python 2.7.11 in C:\Software\Python27 and added both that directory as C:\Software\Python\Scripts to
the system path (for all users, that is). Then I installed SCons in C:\Software\Python27\Lib\site-packages\scons-2.4.1, and
the scripts in the previous mentioned scripts-directory (the directories which the SCons installation msi defaults to).
And now when I try to run SCons I get this error message:
Import failed. Unable to find SCons files in:
...
ImportError: No module named SCons.Script
As a user I really don't have any idea where the error comes from, other than that SCons can't resolve it's own imports.
I got it working by creating though by creating a new folder: C:\Software\Python27\Scripts\scons-local and moving the
contents of the SCons installation folder (...\Python27\Lib\site-packages\scons-2.4.1) to the newly created folder. But this
gives me a syntax error:
I found here that this error is due to my Python version not supporting conditional expressions, because this kind of
expressions are supported from Python 2.4 and higher. The thing is though that I am using Python 2.7.11, and thus I shouldn't get
this error.
Some help would be highly appreciated, thanks in advance!
The windows installer is no longer supported.
The best way to install SCons is now via pip
so:
python -Mpip install SCons
Note you will need Python 3.5 or newer (though at this point I'd suggest 3.10 or newer)

Error when trying to run python 3 (python.exe is not a valid win32 application)

I have python 3.3 on my Desktop and works perfectly fine. I'm trying to install 3.5 on my main laptop I work from, but once it is "successfully installed" (the message the installer always gives me) It doesn't want to open. I get a message saying python.exe is not a valid win32 application. My OS is windows vista.
Go http://www.dependencywalker.com/ and download depends.exe. Run depends.exe and open python exe. If you are lucky it will show you missing dependencies.
Check how to install these. Or post missing dependencies in your question. Maybe someone knows which package to install.
EDIT:
Watch for yellow exclamation/question marks!
EDIT:
Based on eryksun's comment you should install the Vista package from this site: https://support.microsoft.com/en-us/kb/2999226
The problem is that that version of python won't work on your specific version of windows. You are going to have to use python 3.4 as this is the only python 3 version that will work for your os.

How do I get IDLE to find NLTK?

Programming noob here. I'm on Mac OS 10.5.8. I have Python 2.7.6 and have installed NLTK. If I run Python from Terminal, I can "import nltk" with no problem. But if I open IDLE (either from Terminal or by double-clicking on the application) and try the same thing there, I get an error message, "ImportError: No module named nltk". I assume this is a path problem, but what exactly should I do?
The directory where I installed NLTK is "My Documents/Python/nltk-2.0.4". But within this there are various other directories called build, dist, etc. Which of these is the exact directory that IDLE needs to be able to find? And how do I add that directory to IDLE's path?
Supplementing the answer above, when you install python packages they will install under the default version of python you are using. Since the module imports in python 2.7.6 make sure that you aren't using the Python 3 version of IDLE.
Please go through the link given below:
setting-up-nltk-with-python-idle-on-os-x-10-6
HTH! Thanks!

ImportError: no module named py2exe

I get this error when I try to use one of the py2exe samples with py2exe.
File "setup.py", line 22, in ?
import py2exe
ImportError: no module named py2exe
I've installed py2exe with the installer, and I use python 2.6. I have downloaded the correct installer from the site (The python 2.6 one.)
My path is set to C:\Python26 and I can run normal python scripts from within the command prompt.
Any idea what to do?
Thanks.
Edit: I had python 3.1 installed first but removed it afterwards. Could that be the problem?
Sounds like something has installed Python 2.4.3 behind your back, and set that to be the default.
Short term, try running your script explicitly with Python 2.6 like this:
c:\Python26\python.exe setup.py ...
Long term, you need to check your system PATH (which it sounds like you've already done) and your file associations, like this:
C:\Users\rjh>assoc .py
.py=Python.File
C:\Users\rjh>ftype Python.File
Python.File="C:\Python26\python.exe" "%1" %*
Simply removing Python 2.4.3 might be a mistake, as presumably something on your system is relying on it. Changing the PATH and file associations to point to Python 2.6 probably won't break whatever thing that is, but I couldn't guarantee it.
Seems like you need to download proper py2exe distribution.
Check out if your c:\Python26\Lib\site-packages\ contains py2exe folder.
If you have any other versions of Python installed, it may be that another Python version is the default Python. Could this be the case? I believe the default Python installation is determined from a registry setting.
I had the exact same issue and I just managed to get it solved - so I thought I would share my solution.
It turned out that my installation of CollabNet SVN contained an old version of Python that interfered with my recent Python2.7 installation.
Replacing CollabNet SVN with VisualSVN (including a couple of reboots) did the trick. I know this is not a "pretty" solution, as it caused me to uninstall CollabNet SVN - a prettier solution might have been doing modifications to the PATH env. variable... However, I am now able to use py2exe :)
For the record, my very similar problem was caused by using a Cygwin prompt. Using as standard cmd.exe shell instead worked (given all paths and correctly installed versions of python).
This was because (stupid me) the Cygwin install had pulled down it's own version of /usr/bin/python. I equally fixed it by adding the Windows installed python location to the head of the Cygwin PATH=/cygdrive/c/Python27:$PATH.
You might need to install the py2exe module globally, perhaps you might have installed to a virtualenv. I had the same problem, installing the module globally fixed the problem

Categories

Resources