Are there image processing modules for Python 3?
You can get a source version of PIL which will compile on python3.1 here:
https://github.com/sloonz/pil-py3k
also binary installer for 3.2 and 64-bit windows here:
http://www.lfd.uci.edu/~gohlke/pythonlibs/#pil
ref: Image library for Python 3
Including Images in a library with pip install
theres lots of ways to do it ...
one way is to make use of include_package_data
in your setup.py
from setuptools import setup, find_packages
setup(
...
include_package_data=True
)
and include the datafiles in manifest.in
or be more specific
from setuptools import setup, find_packages
setup(
...
package_data={
# If any package contains *.txt or *.rst files, include them:
"": ["*.txt", "*.rst"],
# And include any *.msg files found in the "hello" package, too:
"hello": ["*.msg"],
}
)
(see also: pypi setuptools documentation)
another option is to store them as base64 encoded strings in a python file))
images.py
img1 = "<SOMEB64ENCODED_STR>"
most packages allow you to specify images either as raw bytes or as base64encoded data
How do I install PIL/Pillow for Python 3.6?
For python version 2.x you can simply use
pip install pillow
But for python version 3.X you need to specify
(sudo) pip3 install pillow
when you enter pip in bash hit tab and you will see what options you have
How can I install Image class in Python 3 Ubuntu 14.04?
sudo apt-get install python3-pil python3-pil.imagetk
You may need to manually remove any left-overs of non-successful installs tried with pip or compiling with setup.py - this will be indicated by conflicting files listed in the error message.
The rule of thumb is: If you want a Python general tool for interactive use, or that provides scripts you will use directly, libraries for small scripts for personal use: you have to install the package built for your system (the .deb) with apt-get, aptitude whatever - unless that Python module is not packaged at all.
For all other uses, you should create a Python virtualenv and install the desired modules inside that virtualenv with pip install <name>
. Including the cases Ubuntu does not have the desired Python module packaged.
Regarding PIL there is still another interesting bit: the original PIL had become unmaintained and bit-rot over the years. One of the most proeminent bugs arising from that is exactly it inability to be cleanly installed using pip
or easy_install. Another one is that it never was (at least properly) ported to work with Python3. Due to that a fork named "Pillow" was created. It is a drop-in replacement for the orinal PIL - PIP and Easy_install should install "Pillow" and not "PIL".
(NB. I do not know which PIL or Pillow - is packaged by Ubuntu under the "python-pil" names. I suppose and hope it is the actively maintained project Pillow)
Related Topics
What Is the Fastest Way to Open Urls in New Tabs via Selenium - Python
On Localhost, How to Pick a Free Port Number
Using Requests with Tls Doesn't Give Sni Support
Cast Base Class to Derived Class Python (Or More Pythonic Way of Extending Classes)
What Is This Odd Colon Behavior Doing
Matplotlib and Ipython-Notebook: Displaying Exactly the Figure That Will Be Saved
Pass a Parameter to a Fixture Function
Basic Python Client Socket Example
How to Fit a Sine Curve to My Data with Pylab and Numpy
Pandas Out of Bounds Nanosecond Timestamp After Offset Rollforward Plus Adding a Month Offset
When Are Objects Garbage Collected in Python
Exif Manipulation Library for Python
Download Image with Selenium Python
Get the Name of a Pandas Dataframe
Why Not Generate the Secret Key Every Time Flask Starts
Print All Day-Dates Between Two Dates
Compiling with Cython and Mingw Produces Gcc: Error: Unrecognized Command Line Option '-Mno-Cygwin'