tkinter not installed properly in Anaconda Python 2.7 Win64 - python-2.7

I believe from this post that this is not an uncommon issue with tkinter and new downloads of Python 2.7 (after re-downloading from 2016 on). I am using the Anaconda 2.7 for win64 on a Windows 7 machine. The filepaths seem almost identical to what is described here, except for "Anaconda2" instead of "Python27"; the "tcl" folder is in it's own directory in C:/Users/user:2312900/tcl and not in the "lib" directory.
Is there any way to fix this for Anaconda? That I tried what was described in the post, but it didn't work for me.
Is there any way to manually install a 64bit python 2.7 compatible wheel for tkinter? Does anyone know of any other packages to make simple GUI's with Python if this is an irreconcilable issue with the Annaconda distribution. I have a lot of other packages that were painfully installed that I do not want to use something else.

I am using Anaconda2 64bit and tkinter does indeed work, as I use it frequently. It might be something simple: can you import the package into your program? Try import Tkinter instead, i.e. with a capital 'T'.

Do you have user on your Windows called "user:2312900"? Python (and some other programs) don't like paths with special characters like colon ":". Try to install all your needed programs (Python, Tkinter, etc) in the path without special characters and without spaces " ".
For example: c:\ProgramData\Anaconda3\ or c:\Python27\

Related

Sublime text 2 can not find any python module

I am leaning programming now and get stuck in the very beginning.
I have sublime text 2 installed on my Mac, and I type some python code in and it runs. However, when I start to import module like pandas/matplotlib, it can not find those modules. Certainly I have used pip to install them.
So what is the solution please?
Does Your code work with those modules when You use a different editor?
If it doesn't, Check if the modules You need are indeed installed. You can do this either by using the python prompt:
python
>>> help("modules")
>>> exit()
or using pip:
pip freeze
(sorry for posting this as an answer, but I'm currently not able to post comments)

Python site-packages and corresponding interpreter

I used brew to install python 2.7 and 3.5 on Mac. SOMEHOW I have this site-packages directory /usr/local/lib/python2.7/site-packages.
But every python interpreter on the system points to every other site-packages directory EXCEPT this one. How do I use THIS site-packages directory?
(This is all because I need Vips. I'd installed this before, but now I'm using a different machine and I can't figure out how on Earth I got it to work before.)
The vips docs have a checklist and an explanation of what happens when Python tried to import vips:
http://www.vips.ecs.soton.ac.uk/supported/current/doc/html/libvips/using-from-python.html
But briefly you need to:
You have several Pythons installed, make sure you are invoking the brew one.
Make sure that that Python has a gi repository containing the Vips.py overrides.
Make sure you have a Vips-8.0.typelib file in /usr/local/lib/lib/girepository-1.0/.
SOLVED.
I didn't want to have to resort to resetting my dev box to factory settings, but I did. I hope this helps somebody...
If Python already exists on your system, and you're planning on installing Python yourself or with Homebrew (because you only get python2.7 out of the box), make sure you install the new Python first. Then put the install location first in your PATH. Then install your modules. In that order. I knew something was wrong, so I uninstalled Python/3 and Vips. But when I reinstalled them, for whatever reason Vips still didn't know to bind itself to the Python in /usr/local/Cellar. Even though I had /usr/local/Cellar first in PATH.
So to recap -- first install Homebrew, then set the PATH, then install python/python3, and finally install Vips. And you're good to go.

too many pythons on linux

i recently started using python with xubuntu on virtualbox but i'm having problems. I want to be able to use numpy so i thought that apt-get install python-numpy would solve everything, but using the shell i kept getting No module named numpy. I used IDLE and it could find it. I also have IDLE (using Python-2.7), and again it could import numpy. Then i noticed that the shell had python 2.7.9, while the IDLEs had python 2.7.6.
Using
import sys
print sys.path
this if what i get from 2.7.9 (shell)
/usr/local/lib/python2.7/site-packages/setuptools-17.0-py2.7.egg
/usr/local/lib/python2.7/site-packages/Pillow-2.3.0-py2.7-linux-x86_64.egg
/usr/local/lib/python2.7/site-packages/mock-1.0.1-py2.7.egg
/usr/local/lib/python27.zip
/usr/local/lib/python2.7
/usr/local/lib/python2.7/plat-linux2
/usr/local/lib/python2.7/lib-tk
/usr/local/lib/python2.7/lib-old
/usr/local/lib/python2.7/lib-dynload
/usr/local/lib/python2.7/site-packages
and from 2.7.6 (IDLE)
/home/alessandro
/usr/bin
/usr/lib/python2.7
/usr/lib/python2.7/plat-x86_64-linux-gnu
/usr/lib/python2.7/lib-tk
/usr/lib/python2.7/lib-old
/usr/lib/python2.7/lib-dynload
/usr/local/lib/python2.7/dist-packages
/usr/lib/python2.7/dist-packages
/usr/lib/python2.7/dist-packages/PILcompat
/usr/lib/python2.7/dist-packages/gtk-2.0
/usr/lib/pymodules/python2.7
/usr/lib/python2.7/dist-packages/ubuntu-sso-client
I understand that i have two versions of python installed and somehow i ended up installing packageg into only one of them (the 2.7.6).
I'd like to be able to use 2.7.9 both in the shell and in IDLE and also i'd like to install so that python 2.7.9 can see them.
I read that i can add paths to the python sys.path, but isn't there a more efficient/persistent way to do what i want?
PS: tell me if you need more informations
For my projects I usually create a virtualenv for each python version I need for the project at hand. I manage them using pip to install specific versions that I need. Moreover you should be able to choose the python path in your IDE. While I'm not using IDLE, I read here that apparently idle comes along with the python versions during install. So maybe your idle versions collide with each other. If you want to have only one python version at the time on your machine you might consider a simple remove and fresh install of your desired version. Again I would recommend pip over apt-get etc. Hope this is of help for you.
Worth to check PyDev, a plugin for Eclipse to work on python.
http://marketplace.eclipse.org/content/pydev-python-ide-eclipse , or http://pydev.org/.
This allows you to configure the python version for different project's.
I have some project's with python 2.7 and others with 3.4.
it's checks the whole system in search for the PYTHONPATH to use!

Installing anaconda to use with windows

I am lost in the installation process of installing anaconda on windows.
I've installed the windows 32bit package (I'm running windows 7 x64)
I have anaconda in the start menu and I can open the python console and use scipy.stats.t.interval(), the function I am interested in.
However, how do I go about including this in another python program? I think it's something like adding it to the path. For instance, I have the scipy.stats.t.interval() function call in my other python file which I run through cygwin via python myscript.py. However it returns the error:
from scipy.stats import t
ImportError: No module named scipy.stats
I think it might be a change of path / add to path issue, but I'm not sure how to fix it :/. While I try to fix it, I figure I will post for help here.
well you might have two installations of python, one inside the anaconda package, and other which you might have installed earlier. try doing :
which python
from CygWin console.
If it returns:
/usr/bin
then it is definitely a add-to-path problem.
to fix it for CygWin,
you have to add the python installation from anaconda to the path.
try this fromn CygWin:
PATH=path-where-anaconda-is-installed/anaconda/bin:$PATH
and then doing:
which python
should give you:
/path-to-anaconda/anaconda/bin
and then it will work.
Cheers

Python 32 or 64 on 64 bit Windows 7? How will this effect installing easy_install?

I wrote some python code on my mac and how I have to transfer it over to a windows computer. This is frustrating beyond words. I installed Python 2.7 x32, then I uninstalled it, then I installed Python 2.7 x64. My python script depends on xlrd and xlwt, and some other downloaded modules. I would like to install those using easy_install or pip or any way that is easy for somebody who doesn't know too much about the really intricate workings of a computer. As of now, if I do this:
C:\Windows\System32> python
I get:
'python' is not recognized as an internal or external command operable program or batch file.
Would someone suggest a next move for me?
I did a bunch of google-ing and stackoverflow-ing and seem to have landed here, I'm not sure how to download something from here. For example, how would I download Pip, and also, which one would I download?
People say that a person should download and install this, how would I do that?
I'm familiar with terminal, what would I type into cmd?
The reason that I things were not going well for me was because I was using a mixture of Python 2.7 (32-bit) and Python 2.7 (64-bit). After more researching I found that even though my Windows 7 was 64 bit, I didn't have to download the 64-bit python. In fact, the 32-bit python was more compatible with other programs. So I clicked around and uninstalled python and everything else that had the name 'Python' in it from my Add/Remove programs menu. This took about 10 minutes. Next, I downloaded the 32-bit Python 2.7. After this, all of the packages that I download, I made sure that they were 32-bit and not 64-bit.
Also, very important, I went to my 'Environment Variables' (google how to get there) and added the directory of where Python27 was installed. To do this you can follow this guide. The last thing that I did was add ;.PY to the end of PATHEXT.