I am pretty new in mac version 12.6 . I tried to install python 3.7 in my mac for trying out some legacy project but I am unable to.
I tried two was downloading the .pkg file from python.org and also by pyenv
While the .pkg says successfully installed and pyenv versions gives me 3.7.13 .
While trying python3.7 or python3 from terminal I am getting
% python3
zsh: killed python3
% python3.7
zsh: killed python3.7
But my other versions working fine like
% python3.9
Python 3.9.13 (v3.9.13:6de2ca5339, May 17 2022, 11:37:23)
[Clang 13.0.0 (clang-1300.0.29.30)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
How to fix this isssue.
I usually use pyenv to install and manage Python versions. (You can install it using Homebrew)
1- pyenv install 3.7.0
#To see the list of the Python versions
2- pyenv versions
#To set the newly installed version as the default
3- pyenv global 3.7.0
Now, run python3 --version
if the output is NOT 3.7.0 then you need to add the following lines to your .zsh or .zshrc file:
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init --path)"
and finally update your .zsh or .zshrc file:
source .zshrc or source .zsh
I want to install CNTK with anaconda prompt (Python version 3.9.12)
I used following command:
pip install https://cntk.ai/PythonWheel/GPU/cntk_gpu-2.7.post1-cp36-cp36m-win_amd64.whl
and got this error:
ERROR: cntk_gpu-2.7.post1-cp36-cp36m-win_amd64.whl is not a supported wheel on this platform.
What is the right link that support my platform?
CNTK is no longer actively developed, latest version is 2.7 which works with Python 3.6
That means, Python 3.9 isn't supported.
You can refer to official CNTK page
https://learn.microsoft.com/en-us/cognitive-toolkit/Setup-Windows-Python?tabs=cntkpy26
In my virtual environment I am running on python 3.4.3 but need to upgrade to python 3.7 .
Show version and brew install
I have tried brew install python3 and changing the link and homebrew tells me python 3.7 is installed. When I do python --version it states python 3.4.3.
i think the best method is to leave Python 3.4.3 as is and install python 3.7. Then after installing 3.7 create a new virtual environment for python 3.7. To run 3.7 you just activate that environment.
I have python 2(as default) and 3 on my Linux machine. I created a virtual environment to try out pandas with python3. So, I ran:
virtualenv -p python3 pandas_env
If I type python inside of this env it goes to the standard python shell, with python 3 as the default version
(panda_env)$ python
Python 3.4.3 (default, Sep 14 2016, 12:36:27)
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
To install ipython, I did:
(panda_env)$ pip install ipython
now, running ipython, it defaults to python2 instead of 3
(panda_env)$ ipython
WARNING: Attempting to work in a virtualenv. If you encounter problems, please install IPython inside the virtualenv.
Python 2.7.6 (default, Jun 22 2015, 17:58:13)
Type "copyright", "credits" or "license" for more information.
IPython 2.3.1 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
With a WARNING saying to install ipython inside virtualenv. I thought did installed ipython inside the environment, and why is it using python2.x by default?
How do I install ipython inside virtualenv correctly, and how can I make ipython use 3.x instead of 2.x?
Also, should I use pip or pip3 to install packages inside a virtualenv?
Note, for python > 3.3 it's recommended you start a virtual environment with the pyvenv command. This has now been deprecated as of python > 3.6 in favor of python3 -m venv <environment name> (via https://docs.python.org/3/library/venv.html)
In answer to your question, I don't believe it matters based on this check:
# start enviroment
$ python3 -m venv test_env; source test_env/bin/activate
# check python version
(test_env) $ python --version
Python 3.6.0
# check pip and pip3
(test_env) $ which pip
~/Documents/test_env/bin/pip
(test_env) $ which pip3
~/Documents/test_env/bin/pip3
# The pip commands are different, but if we check their versions they are the same and both appear to be using python3.
(test_env) $ pip -V
pip 9.0.1 from ~/test_env/lib/python3.6/site-packages (python 3.6)
(test_env) $ pip3 -V
pip 9.0.1 from ~/test_env/lib/python3.6/site-packages (python 3.6)
# In fact the binaries for pip and pip3 within the environment are identical as you can see with this.
(test_env) $ diff ~/Documents/test_env/bin/pip ~/Documents/test_env/bin/pip3
# Checking with ipython
(test_env) $ pip install ipython
(test_env) $ ipython
Python 3.6.0 (default, Dec 24 2016, 08:01:42)
Type "copyright", "credits" or "license" for more information.
IPython 5.1.0 -- An enhanced Interactive Python.
The easiest way to work with virtual environments is to download anaconda and use the conda version control system:
Works exactly the same way for all versions of python
Python is treated as just another package as part of the environment
Everything related to an environment is stored in one folder
You can see revision history and rollback to previous versions of the environment if something stops working
I'm using a Mac OS x 10.10.3 Yosemite, and Python 2.7.9 |Anaconda 2.2.0 (x86_64) for a lot of python stuff. I'm using eclipse, and google app engine.
I'm running out of stack overflow posts to read for this error that a lot of people have, then resolve by some means that has not work for me.
I'm getting this error:
import Image
ImportError: No module named Image
From this code:
try:
from PIL import Image
except:
import Image
After I already tried the following:
conda install pillow
sudo pip install pillow
pip install pillow
pip install pil
Some stack overflow post suggested seeing if the path was there for another user, so I tried this in my terminal:
python
Python 2.7.9 |Anaconda 2.2.0 (x86_64)| (default, Dec 15 2014, 10:37:34)
[GCC 4.2.1 (Apple Inc. build 5577)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://binstar.org
>>> import sys
>>> print(sys.path)
and got:
['',
'/Users/jrussek/anaconda/lib/python27.zip',
'/Users/jrussek/anaconda/lib/python2.7',
'/Users/jrussek/anaconda/lib/python2.7/plat-darwin',
'/Users/jrussek/anaconda/lib/python2.7/plat-mac',
'/Users/jrussek/anaconda/lib/python2.7/plat-mac/lib-scriptpackages',
'/Users/jrussek/anaconda/lib/python2.7/lib-tk',
'/Users/jrussek/anaconda/lib/python2.7/lib-old',
'/Users/jrussek/anaconda/lib/python2.7/lib-dynload',
'/Users/jrussek/anaconda/lib/python2.7/site-packages',
'/Users/jrussek/anaconda/lib/python2.7/site-packages/Sphinx-1.2.3 py2.7.egg',
'/Users/jrussek/anaconda/lib/python2.7/site-packages/aeosa',
'/Users/jrussek/anaconda/lib/python2.7/site-packages/cryptography-0.8-py2.7-macosx-10.5-x86_64.egg',
'/Users/jrussek/anaconda/lib/python2.7/site-packages/setuptools-14.3-py2.7.egg']
I thought it wasn't in my path so I tried to append the thing:
PYTHONPATH=/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PIL
didn't look like it showed up.
So I tried uninstalling, and reinstalling, in 10 different ways. I only did that for pillow, not PIL because I tried different things for PIL and looked at a lot of posts that said use pillow, not PIL because PIL is deprecated.
Anyway, for pillow I keep getting:
Requirement already up-to-date: pillow in ./anaconda/lib/python2.7/site-packages
clearly pillow is already installed in anaconda, but that doesn't help the import error I keep getting.
so then I tried conda install pillow,
and it upgraded some stuff:
but.. I try running my code again, and I still get no module found, no matter what import statement I try.
Suggestions? Please? Anyone?
The following does work for me:
from PIL import Image
And this does not work:
import Image
Pillow package
$ conda search pillow
Fetching package metadata: ....
pillow 2.1.0 py33_0 defaults
2.1.0 py27_0 defaults
2.1.0 py26_0 defaults
2.3.1 py34_0 defaults
2.3.1 py33_0 defaults
2.3.1 py27_0 defaults
2.3.1 py26_0 defaults
2.4.0 py34_0 defaults
2.4.0 py33_0 defaults
2.4.0 py27_0 defaults
2.4.0 py26_0 defaults
. 2.5.1 py34_0 defaults
2.5.1 py33_0 defaults
2.5.1 py27_0 defaults
2.5.1 py26_0 defaults
2.7.0 py34_0 defaults
2.7.0 py33_0 defaults
2.7.0 py27_0 defaults
2.7.0 py26_0 defaults
2.7.0 py34_1 defaults
2.7.0 py33_1 defaults
2.7.0 py27_1 defaults
2.7.0 py26_1 defaults
2.8.1 py34_1 defaults
2.8.1 py33_1 defaults
2.8.1 py27_1 defaults
2.8.1 py26_1 defaults
2.8.1 py34_2 defaults
2.8.1 py33_2 defaults
2.8.1 py27_2 defaults
2.8.1 py26_2 defaults
2.8.2 py34_0 defaults
2.8.2 py33_0 defaults
2.8.2 py27_0 defaults
2.8.2 py26_0 defaults
* 2.9.0 py34_0 defaults
2.9.0 py33_0 defaults
2.9.0 py27_0 defaults
2.9.0 py26_0 defaults
Python path
$ python
Python 3.4.3 |Anaconda 2.1.0 (x86_64)| (default, Mar 6 2015, 12:07:41)
[GCC 4.2.1 (Apple Inc. build 5577)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> print (sys.path)
['', '/Users/erwin/anaconda/lib/python34.zip', '/Users/erwin/anaconda/lib/python3.4', '/Users/erwin/anaconda/lib/python3.4/plat-darwin', '/Users/erwin/anaconda/lib/python3.4/lib-dynload', '/Users/erwin/anaconda/lib/python3.4/site-packages', '/Users/erwin/anaconda/lib/python3.4/site-packages/Sphinx-1.3.1-py3.4.egg', '/Users/erwin/anaconda/lib/python3.4/site-packages/setuptools-18.1-py3.4.egg']
Image usage
This works both in my terminal and in Eclipse PyDev now.
>>> from PIL import Image
>>> a = Image.new("RGB", (512,512), "red")
>>> a.show()
At first, try installing Pillow with (Capital letter P)
pip install Pillow
then use
from PIL import Image
"Pillow is a fork of PIL, the Python Imaging Library, which is no longer maintained. However, to maintain backwards compatibility, the old module name is used." From: pillow installed, but "no module named pillow" - python2.7 - Windows 7 - python -m install pillow
Newer version of Pillow has been changed decleration of "image" as:
from PIL.Image import core as image
I've been in the same position as you at least a few times, and I somehow managed to resolve it through other solutions. Then it broke again. Here is what I did that fixed it:
Open two finder windows.
In one, navigate to:
//anaconda/pkgs/pillow-3.2.0-py27_0/lib/python2.7/site-packages
In this folder, you will find the folder
PIL
Copy this folder and paste it somewhere accessible.
Now open your python 2.7 environment folder within the anaconda directory. For me, it's:
//anaconda/envs/py27/lib/python2.7/site-packages
You should only have to change the "py27" in that.
Even if there is already a folder in there named "PIL", put your copied PIL in the new site-packages folder. From what I can tell, the existing PIL folder in there is old or wrong, or something. Or pillow doesn't install it correctly. I think this amounts to a manual installation of a python module. Super fun.
I was running into the same problem as OP:
macOS 10.12.5
Python 2.7.13 [GCC 4.2.1 Compatible Apple LLVM 8.1.0 (clang-802.0.38)] on darwin
The problem ended up being the the .py file I was trying to run.
At the top of the script there was a shebang: #!/usr/bin/python
However, my default python does not run from the system installation. I used homebrew to upgrade python, so my default path is:
$ which python
/usr/local/bin/python
I changed the shebang at the top to #!/usr/local/bin/python, and after that I was able to run my script (which was calling from PIL import Image).