Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
298 views
in Technique[技术] by (71.8m points)

pygtk - Cannot Import GST in Python

I'm in a quandary. I'm following the following tutorial (specifically, 6.4.2)

http://majorsilence.com/pygtk_audio_and_video_playback_gstreamer

I'm running Python 2.7, PyGTK 2.24, and GStreamer WinBuilds 10.7 (the main installer and the SDK).

When I try and compile the program, I get the following error:

Traceback (most recent call last): File "", line 1, in import gst File "C:Program FilesOSSBuildGStreamerv0.10.6libsite-packagesgst-0.10gst__init__.py", line 193, in from _gst import * ImportError: DLL load failed: The specified module could not be found.

How do I get the gst module to import? (Mind you, I checked, and pygst DOES import.)

Thank you in advance!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

This is because you are using Python 2.7, and the GST default is 2.6. This is really easy to fix:

Go to C:Program FilesOSSBuildGStreamerv0.10.6sdkindingspythonv2.7lib

and copy

gstreamer-0.10 and site-packages to

C:Program FilesOSSBuildGStreamerv0.10.6lib, replacing any existing files.

Then delete the file C:Program FilesOSSBuildGStreamerv0.10.6libgstreamer-0.10libgstpython-v2.6.dll (or change the extension to .dllx or something).

Now it should work.

Alternatively to changing GST to suit Python 2.7, you could just use Python 2.6.

EDIT: After attempting to install Gstreamer on a new computer, I found that I could not import pygst until I removed the extra backslash from C:Program FilesOSSBuildGstreamerv0.10.7libsite-packages in PYTHONPATH. I believe this may have been your problem all the way along.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...