I cannot get pygame to work with python - python

I have had a few dozen attempts at installing pygame to my python. I have tried many different versions of the programs.
I am running a 64 bit version of windows 10, and seem to be required to use an unofficial .whl file to get pygame, however i do not know how to use this file.
I have tried running several variants of commands that was explained in many areas, however they all ether return errors, or yield no success.
Am i doing something wrong?

I too had problems while following the instructions on the website.
I did it the traditional way, Using PIP.
Just open cmd. Upgrade your pip.
pip install --upgrade pip
and then
pip install pygame
This will automaticallly get the correct version of pygame .whl package according to your system configurtaion. Make sure you remember this version of .whl package as it is the one you will be looking for in future installation of .whl packages.

Related

Converting a Python file into a desktop application

I've coded a game in Pygame using Pycharm, and I want to make it into a downloadable desktop application so that other people can download and use it even if they do not have python or the necessary files. The problem is I don't know how to. I've heard of py2exe and py2app before. I tried py2exe but then realized that .exe was for windows, and I was using a Mac. I read the py2app documentation, but it was very confusing and hard to understand, and none of the things they said worked. They said to use the pip command to install py2app inside the terminal, but I tried it and it said that it did not recognize the pip command. Can someone please help? Thanks!
Sorry if this question is long. I am trying to tell as much information as possible.
You can use pyinstaller if you package the application in Mac OS it will run on Mac.
Click here for instruction on how to install the package and use it.
Which installation of Python do you use? I had bad experience with Homebrew when it came to packaging, then I've removed it and switched to Python3.9 downloaded directly from python.org and everything works well now.
Depending on your Python installation, it is possible that you don't have pip installed on your computer. Via terminal, you can check it using
python -m pip --version
and you should get a response of this type:
pip X.Y.Z from .../site-packages/pip (python X.Y)
If you don't have pip, you can either re-install Python as mentioned above, or you can just install pip using these instructions.
As soon as you have pip installed, you can install py2app using
pip install py2app

Installing PyHook python 3.7 64 bit

I’ve been trying to pip install pyHook for about 3 hours and tried every method that I can possibly think of or find but I can’t seem to get it to work. I get the error:
Requirement ‘pyHook-1.5.1-cp37-cp37m-win32.whl’ looks like a filename,but file does not exist. Than it says pyHook-1.5.1-cp37-cp37m-win32.whl is not a supported wheel on this platform.
Please help.
Head over to this link
Then find pyhook and install pyHook-1.5.1-cp37-cp37m-win32.whl.
Go to cmd and type pip install followed by the path of your pyhook file. For example:
C:\\user\download\pyHook-1.5.1-cp37-cp37m-win32.whl
Since you seem to have python3:
pip3 install pyHook
This should work.
You're also probably on a 64 bit Computer, so in the original wheel method, install the one with the _amd64 suffix.
If one is using Windows, for installing pyHook, download the file related with your system version (32/64) from here.
Note that for whl files one may need to install the wheel package, as
pip install wheel
And then
pip install file_name.whl

Installing PySide without PIP

I'm trying to install PySide on my work computer. I got everything installed at home which was simple enough. However at work I'm stuck behind a firewall which I can't get around and therefore can't install PIP.
Is there a binary for PySide that I might be able to use or any other solution?
Thanks!
OS is Win 7 32-bit
Also I'm using Python 3.4
You will find it here (it is an executable):
http://www.lfd.uci.edu/~gohlke/pythonlibs/#pyside
Enjoy! :)
You can download the wheel distribution from PyPI [1] and install with PIP offline.
And you don't loose the benefits of installing packages via PIP.
https://pypi.python.org/pypi/PySide#downloads
Here is direct link to package for your system and python version: https://pypi.python.org/packages/3.4/P/PySide/PySide-1.2.2-cp34-none-win32.whl

Trouble installing scipy despite having python2.7 and numpy installed already

I'm having trouble installing scipy via the binaries provided at http://sourceforge.net/projects/scipy/files/scipy/
Double clicking on the mpkg file after mounting the dmg installer gives the following error:
"scipy 0.13.0 can't be installed on this disk. scipy requires System Python 2.7 to install"
However, I already have python 2.7 and numpy installed. The python 2.7 came default with OSX Lion, so I assume it is System Python. With other python modules, one normally can download the binary then run
python setup.py install
Is there a way to cd through the mpkg file and locate a setup.py? Any advice install via this dmg installer?
I know there are other ways to manage python modules, like port and brew. However, I already installed a bunch of packages through setup.py, and I couldn't figure out how to get port to recognize those packages (for example, it will try to reinstall python and numpy via port)
Thanks!
If you have Mavericks and XCode 5, then you'll have to install Command Line Tools manually from the Apple Developer Site. I found this helpful post
You've got a few misconceptions here.
With other python modules, one normally can download the binary then run python setup.py install
No, that's what you do with source packages.
Is there a way to cd through the mpkg file and locate a setup.py?
No. What's inside an mpkg are pkg files. Which are filled with xar archives filled with cpio archives. Inside there is the built version of SciPy—that is, the files that setup.py would have copied to your site-packages if you'd run it—not the source package.
But you can download the source package yourself.
Or, better, let pip (or easy_install, but pip is better) download and run the setup.py for you.
Any advice install via this dmg installer?
If it won't work, my advice would be to not use it, and instead install with pip.
This blog post explains it, but I'll give you the details relevant to you below.
I know there are other ways to manage python modules, like port and brew. However, I already installed a bunch of packages through setup.py, and I couldn't figure out how to get port to recognize those packages.
You can't. MacPorts will not touch your system Python; it builds its own separate Python 2.7, with a completely independent site-packages directory and everything else. You would have to reinstall everything for this second Python 2.7. And deal with the confusion of having two Python 2.7 installations on the same machine.
Don't do that unless you absolutely have to.
In fact, if you want to use Homebrew for anything (and you do, see below), uninstall MacPorts, unless you really need it for something.
So, here are the steps:
Uninstall MacPorts.
I assume you already have Xcode and its Command Line Tools.
I assume you already have Homebrew.
Install a Fortran compiler with brew install gfortran.
Lion's Python 2.7 comes with easy_install, but not pip. So sudo easy_install pip to fix that. While you're at it, I'd suggest sudo easy_install readline, because you'll want that for ipython, and it won't work right with pip.
Apple's pre-installed NumPy has to be upgraded, and rebuilt with Fortran support, to make SciPy work. Fix that with sudo pip install --upgrade --force-reinstall numpy.
If you want ipython, pandas, etc. sudo pip install each of them as well.
In case you're considering upgrading soon, the exact same steps worked for me with OS X 10.9.0, except for some extra work to get the Xcode 5 command line tools set up.

How to install pywin32 module in windows 7 [duplicate]

This question already has answers here:
ImportError: no module named win32api
(15 answers)
Closed 3 years ago.
I am trying to install pywin32. I downloaded it from sourceforge.net. When I run
setup.py install
it shows "Unable to find vcvarsall.bat". I Googled about it and found that I have to install MinGW and set path then run
python setup.py build --compiler=mingw32
but it's showing
Can't find a version in Windows.h
Can anybody help? (I have a trial version of Visual Studio 2010 Ultimate installed and MinGW C and C++ compiler installed. Operating system: Windows 7.)
Can anybody tell me a source from where I can download Python binaries already compiled in MinGW, so I don't have to do all this. Or if I can get a python which already have Windows modules.
You can install pywin32 wheel packages from PYPI with PIP by pointing to this package: https://pypi.python.org/pypi/pypiwin32 No need to worry about first downloading the package, just use pip:
pip install pypiwin32
Currently I think this is "the easiest" way to get in working.
are you just trying to install it, or are you looking to build from source?
If you just need to install, the easiest way is to use the MSI installers provided here:
http://sourceforge.net/projects/pywin32/files/pywin32/
(for updated versions)
make sure you get the correct version (matches Python version, 32bit/64bit, etc)
I disagree with the accepted answer being "the easiest", particularly if you want to use virtualenv.
You can use the Unofficial Windows Binaries instead. Download the appropriate wheel from there, and install it with pip:
pip install pywin32-219-cp27-none-win32.whl
(Make sure you pick the one for the right version and bitness of Python).
You might be able to get the URL and install it via pip without downloading it first, but they're made it a bit harder to just grab the URL. Probably better to download it and host it somewhere yourself.
I had the exact same problem. The problem was that Anaconda had not registered Python in the windows registry.
1) pip install pywin
2) execute this script to register Python in the windows registry
3) download the appropriate package form Corey Goldberg's answer and python will be detected
Quoting the README at https://github.com/mhammond/pywin32:
By far the easiest way to use pywin32 is to grab binaries from the most recent release
Just download the installer for your version of Python from https://github.com/mhammond/pywin32/releases and run it, and you're done.

Categories