Python 2.6.7 not initialing in windows - python

I am trying to get Python to run to use with Blender. I have 64 bit Vista SP2. 2.6.7 Python. When I start python the command prompt tells me this
'imprt site' failed; use -v for traceback
Traceback <most recent call last>:
File "c:\Python26\Scripts\pypm-script.py", line 5, in <module>
Import Error: No module named pkg_resources
So, I opened pypm-script.py
#!python2.6.exe
# EASY-INSTALL-ENTRY-SCRIPT: 'pypm==1.3.4','console_scripts','pypm'
__requires__ = 'pypm==1.3.4'
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.exit(
load_entry_point('pypm==1.3.4', 'console_scripts', 'pypm')()
)
This is very frustrating, because have no idea how to read code or how to use Python! I hope this is easily fixable.

The file pypm-script.py (and pkg_resources) come from ActivePython. You probably must have installed a different Python on top of ActivePython. I can think of two ways to fix this problem:
Uninstall Python, remove C:\Python26 and install ActivePython 2.6 (or 2.7), or
Remove C:\Python26\Scripts\pypm* and C:\Python26\Lib\site-packages\pypm*

Related

wxPython import error with Windows install

I have installed Python 3.4 and wxPython Phoenix on Windows 10. I go into Eclipse and add wxPython to the external libs in my project, but when I try to import it, I get this error:
Traceback (most recent call last):
File "C:\Users\linus\workspace\MiCS 1.2\main.py", line 1, in <module>
import wx
File "C:\Python34\Lib\site-packages\wx\__init__.py", line 17, in <module>
from wx.core import *
File "C:\Python34\Lib\site-packages\wx\core.py", line 6, in <module>
from ._core import *
ImportError: DLL load failed: The specified module could not be found.
I did some searching and tinkering and still can't figure out what's causing it. It shouldn't be the msvcp or msvcr DLLs as I have Office running just fine (or is that an incorrect assumption?) Any help is appreciated. Thanks.
How did you install wxpython?
As of now, the top page of the official site has wxpython 3.0 only for python27. So, I suspect you might not have installed it properly.
If you have your python34 at C:/Python34 then, cd to C:/Python34/Scripts first so that we make sure to use the pip for this python.
According to this post (https://groups.google.com/forum/#!topic/wxpython-dev/LmGIrQyh7jc), try
pip install -U --pre -f http://wxpython.org/Phoenix/snapshot-builds/ wxPython_Phoenix
This should find the corresponding whl file for your python version and CPU architecture.
Or, you could manually download whl file at http://wxpython.org/Phoenix/snapshot-builds/
If you have 32 bit Python34, then look for ******-cp34-none-win32.whl
and simply do:
pip install path/to/the/whl/that/you/just/downloaded/wxPython_Phoenix-3.0.3.dev1839+4ecd949-cp34-none-win32.whl
After this, if you can import wx in the normal cmd then the problem should be coming from eclipse.

Custom python install location: tkinter problems

I'm using Ubuntu 14.04. While I have to retain my "main" python install as 2.7.6, I need to install 2.7.9 to be able to use ssl.SSLContext, to get Flask to deal with HTTPS requests.
However, if I just do:
sudo make install
or
sudo make altinstall
in the Python-2.7.9 directory, I ultimately get:
make: *** [libinstall] Error 1
EDIT: this appears at the end of sudo make install:
...
Compiling /usr/local/lib/python2.7/xml/sax/saxutils.py ...
Compiling /usr/local/lib/python2.7/xml/sax/xmlreader.py ...
Compiling /usr/local/lib/python2.7/xmllib.py ...
Compiling /usr/local/lib/python2.7/xmlrpclib.py ...
Compiling /usr/local/lib/python2.7/zipfile.py ...
make: *** [libinstall] Error 1
So I installed it to a custom directory by modifying the call to ./config, which did not yield the libinstall error.
However, when I try to import Tkinter into Python 2.7.9 (running from the custom directory) I obtain:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/repos/Python279/lib/python2.7/lib-tk/Tkinter.py", line 39, in <module>
import _tkinter # If this fails your Python may not be configured for Tk
ImportError: No module named _tkinter
If I just go ahead and install the vanilla way (i.e., to a non-custom directory) and simply ignore the libinstall error I get, upon importing Tkinter:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/lib-tk/Tkinter.py", line 39, in <module>
import _tkinter # If this fails your Python may not be configured for Tk
ImportError: /usr/lib/python2.7/lib-dynload/_tkinter.so: undefined symbol: PyFPE_jbuf
Does anyone have any idea what is going on?
Following furas' suggestion, installing via the
Python 2.7 PPA maintained be Felix Krull worked spectacularly. Thanks Furas!
EDIT Some notes:
Because this PPA installs python2.7 (specifically v. 2.7.11, as of 1/29/2016), this obviated the need for a custom python install location
While the PPA website mentions that this doesn't include python-tk, provided you have installed it, python plays with it just fine (solving my problem)
First of all source code from a program must be configured, compiled, then installed. You can do this by:
./configure # Or ./config depending on the file name
make
make install
Second of all when you tried to import the module _tkinter you wanted to import the .py file which was called Tkinter.py
Try to use:
import Tkinter

Error during library import in Python (Windows)

I am trying to configure svn hook for email notification using mailer.py script from apache, but it always crash on import of svn libs. I try two ways of installing svn and python. I try to install everything manually using command line and use CollableNet installer that have preinstalled Python and all libs I need but result is the same.
Now I try to import one library from hole package that I need using python in command line and I have such response:
>>> import svn.core
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named svn.core
I try to fix it using:
1) import sys; sys.path.append("C:\csvn\lib\svn-python\svn")
and
2) C:\csvn\lib\svn-python\svn>python "\__init__.py" install
But it didn't help.
For now I have no package with setup.py to install it.
I spend a lot of time on this task, and going crazy a little). Please give me any suggestion how to fix it.

Import vim in python gives back errors

I read some articles about Vimscripting with python. I felt very interested. So I tried to figure out how to do vimscripting with python.
But when I tried to import vim, it showed that the module vim wasn't installed. So I searched
on the web, but still haven't find the module to install.
I also tried pip to search automatically, still failed.
Does anyone know where to find the module vim?
I am using fedora 17, and I have installed vim 7.3 and python 2.7.
Thanks in advance.
Here is the error message:
>>> import vim
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named vim
It doesn't seem like you need to import it, just make sure your vim is compiled with python support. Check this using vim --version | grep +python. Further, it seems that the vim module is imported automatically when in vim, rendering your import line unnecessary.
it do not work but this will work
:python from vim import *
:python command('echo "Hello World!"')
if you put vim.command(..
You get
Traceback (most recent call last):
File "<string>", line 1, in <module>
NameError: name 'vim' is not defined
Compile VI with python as described by hd1. You can find the documentation here:
http://vimdoc.sourceforge.net/htmldoc/if_pyth.html
If you want to test
export PYTHONPATH=$HOME/local/lib/python2.7/site-packages
Note that I installed all in local, this is why I use $HOME in PYTHONPATH
Run vi then, type
:python from vim import *
:python vim.command('echo "Hello World!"')
you should see "Hello World!" below.

Python 32-bit can't find MySQLdb module on OS X Lion

I've been tearing my hair out and trying the solutions to getting Python and MySQL to play nicely with 64-bit architecture, and the solution seems to have all components installed/run as 32-bit.
My issue is that for some reason, running Python in 32-bit mode via
$ arch -i386 /System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7
and then
import MySQLdb
gives me
import MySQLdb
Traceback (most recent call last):
File "", line 1, in
ImportError: No module named MySQLdb
However, when I run python in 64-bit mode and trying 'import MySQLdb' I get the dreaded:
import MySQLdb
Traceback (most recent call last):
File "", line 1, in
File "build/bdist.macosx-10.6-intel/egg/MySQLdb/init.py", line 19, in
File "build/bdist.macosx-10.6-intel/egg/_mysql.py", line 7, in
File "build/bdist.macosx-10.6-intel/egg/_mysql.py", line 6, in bootstrap
ImportError: dlopen(/Users/me/.python-eggs/MySQL_python-1.2.3-py2.7-macosx-10.6-intel.egg-tmp/_mysql.so, 2): no suitable image found. Did find:
/Users/me/.python-eggs/MySQL_python-1.2.3-py2.7-macosx-10.6-intel.egg-tmp/_mysql.so: mach-o, but wrong architecture
So my question is, why can't Python find the module in 32-bit mode? the "wrong architecture" error leads me to believe that MySQL-python is installed as 32-bit, so I don't think it's that 32-bit Python can't "see" the module. I have both the python and the .python-eggs path on my $PATH in .bash_profile, so what am I missing here?
Not exactly an answer, but have you tried just to pip install MySQL-python? If you have some mysql_config in your path, it should compile just fine.
– I am using a Python 2.7.2 via homebrew, a MAMP 2.0 installation, running on 10.6. with a 64bit kernel.

Categories

Resources