Trying to install Swampy for Python. - python

So I'm following the 'Think Python' PDF guide and this is my first real hurdle. I tried to follow a guide to install it but it's completely over my head. I know this is vague but if anyone could guide me through it like I'm a pensioner I'd be grateful.
I'm currently using Python 2.7.6. I think I downloaded setup tools and PIP but I can't be too sure.
Sorry for the openness and vagueness of this question but I'm quite stuck.

Edit: Since you're on Windows, I suggest you download and run this installer for Pip.
Once that's done, if you've downloaded and installed Pip correctly, all you should have to do is open a terminal, type pip install swampy, and press return.
In order to test if you've installed Swampy correctly, do the following:
Open a command prompt.
Type python and press return
Type from TurtleWorld import * and press return.
If you've installed Swampy correctly, you shouldn't see any error messages. If you see something like this ImportError: No module named TurtleWorld, Swampy isn't installed correctly yet.
References:
This answer on installing Pip on Windows.
This answer on
installing Swampy on Windows.
This page on setting up Swampy
from an intro CS course at UCSB.

Download Swampy package tar.gz, extract it:
$ tar -zxvf [swampy-package-name]
cd to Swampy folder, in command line, you type:
$ sudo python setup.py install
run python
$ python
from Swampy.TurtleWorld import *
or run follow example of think python
$ python polygon.py
It work by python. some other python version doesn't work.

Related

Import packages (pip) facility doesn't work on Mac

probably was asked 100 times but I will try once again ( maybe will get a simple answeR)
I used the commands:
url https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3 get-pip.py
from a mac terminal to install pip. When I am going to the IDLE shell window and I am typing :
pip3 install numpy
I am getting a syntax error even though it's supposed to work.
Can somebody explain to me what is the issue?
I am not keen on downloading Anaconda as I like to keep my environment simple enough.
I am working with a mac notebook. any help will be most appreciated.
Thanks, YK
The IDLE shell window is a Python interpreter and only understand python syntax. Since pip3 install numpy is not valid Python, you get a syntax error. Instead, you need to open Terminal and type the command there.
You cant install packages through the python idle.
Try installing numpy through your mac terminal.
If it still does not work check if pip is even installed by pip --version or pip3 --version. The reason that downloading a package in the python IDLE does not work is because the python IDLE only understands valid python code(it is a python interpreter), and because pip3 install numpy is not python code it does not work

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

Error to import PyInstaller Module and compile it

I am trying to import the PyInstaller module in myscript.py, It work well as py extension but it doesn't work when I compile it with PyInstaller.
from PyInstaller.__main__ import run
And I have this message when I execute myscript.exe :
PyInstaller cannot check for assembly depencies. Please install PyWin32 or pywin32-ctypes.
pip install pypiwin32
I looked and I have already this module "pypiwin32". I searched everywhere before to post my request here. Any help is welcome, thanks !
Make sure you are using the python you are installing to. The best way is to cmd to the pip python dir and run install from there.
Other option is to use Anaconda. It will install to the right one.
If you have few pythons on your computer the "pip install" will choose the first one he see's in PATH.

Error installing package with pip

I'm trying to install a charting tool (matplotlib-v1.4.2) for python 3.4 in Windows 7, so far all my trails doesn't seem to do the job.
Attempts:
I've downloaded pip from GitHub
python -m pip install matplotlib on Command Prompt[DOS] - No Use
There's a similar question posted here, tried these suggestions too but I get the following error
'$' is not reconginized as an internal or external command.
I'm sure I'm missing something, your step by step guidance on this regard would be much appreciated.
The $ refers to the beginning of a shell prompt, you shouldn't actually include it in your command :)
So rather than (from the example question you posted)
$ pip install requests
you actually type
pip install requests
In any case, you can download matplotlib .exe files from here for use in Windows. Make sure you get the correct bitness (32bit vs 64bit) and the correct Python version.
$ in the example signifies the linux prompt, which in windows is usually >
You can install the library by either using pip install, or using this link http://matplotlib.org/downloads.html
Additionally, most python packages for windows can be easily installed by using the installers from this site http://www.lfd.uci.edu/~gohlke/pythonlibs/

how to install matplotlib in python 3 with os windows

from this site
http://matplotlib.sourceforge.net/users/installing.html#installing-from-source
tell us that the requirement is python 2.4 or later but not python3.
Now im working with python3 and i need some plot form matplotlib.
So how to solve it?
I'm sorry, but at the current time it's not supported.
If you feel brave, you can try with the Py3k SVN branch which reportedly works with a simple example. Be aware that there has been no update in the last 8 months on this though.
Of course, you'd be more than welcome to contribute to the porting to Python 3 if you could.
You could try the unofficial versions. Check this site:
http://www.lfd.uci.edu/~gohlke/pythonlibs/
Looking at the docs at the link it says the following is a dependency:
Python (>= 2.7 or >= 3.4)
You can download a version of Python that will work at:
https://www.python.org/downloads/windows/
I would go with the most recent release and a 64 bit version as certain libraries for data analysis do not run on the 32 bit version of Python.
The version of Python you download will come with pip which you can then use to install any libraries you need to do your work.
Make sure you have set your environment variables if you want to run your programs from the command line or bash terminal.
I installed matplotlib through the bash terminal with:
pip install matplotlib
Let me know if that helps.
To install matplotlib on windows, first, you have to install pip first to install pip on windows go to website
https://pip.pypa.io/en/stable/installing/#do-i-need-to-install-pip
Download get-pip.py, being careful to save it as a .py file rather than .txt. Then, run it from the command prompt:
python get-pip.py
if pip is already installed, install matplotlib by writing in command prompt:
python -mpip install -U pip
python -mpip install -U matplotlib

Categories