I install PyQt5 and PyCharm on Linux (python 3.5.2), but after this easy code:
import sys
from PyQt5 import QtGui
from PyQt5 import QtCore
from PyQt5.QtWebEngineWidgets import QWebEngineView
app = QtGui.QGuiApplication(sys.argv)
window = QWebEngineView()
window.load(QtCore.QUrl("https://google.com"))
window.show()
sys.exit(app.exec_())
I have this Error:
Traceback (most recent call last): File
"/home/user/Browser/BrowserQt5.py", line 4, in
from PyQt5.QtWebEngineWidgets import QWebEngineView
ImportError: libQt5WebEngineWidgets.so.5: cannot open shared object file: No such file or directory
How to fix this Error?
Related
I got this error on PyCharm
Traceback (most recent call last)
from import QtCore, QtGui, QtWidgets ModuleNotFoundError: No module named 'PyQt5'
this is the import statement
from PyQt5 import QtCore, QtGui, QtWidgets
Although that I have checked the library in terminal using pip3 command and it works.
Also, I have configured manually the interrupter to be with python3 but still the error not resolved. Any idea of solving this issue?
I just installed kivy using the command line as instructed in the kivy site but when i run this code:
import kivy
kivy.require('1.10.1')
from kivy.app import App
from kivy.uix.button import Label
class HelloWorld(App):
def build(self):
return Label(text="hello world")
HelloWorld = HelloWorld()
HelloWorld.run()
it returns this error:
C:\Users\OnlyMe\PycharmProjects\kivy\venv\Scripts\python.exe C:/Users/OnlyMe/PycharmProjects/kivy/kivytut.py
Traceback (most recent call last):
File "C:/Users/OnlyMe/PycharmProjects/kivy/kivytut.py", line 1, in <module>
import kivy
ModuleNotFoundError: No module named 'kivy'
I searched for answers on this site as well as googling it but it does not seem relevant on this current version of Kivy.
Any help will do. Thanks in advance :)
Trying to convert a .py file into a .exe
when trying to run the .exe file in the exe.win32-3.6 folder I get the following error:
C:\Users\Aktan\Desktop\build\exe.win32-3.6>StatisticsCalculator.exe
Fatal Python error: Py_Initialize: unable to load the file system codec
Traceback (most recent call last):
File "C:\Users\Aktan\AppData\Local\Programs\Python\Python36-32\lib\encodings\__init__.py", line 31, in <module>
ModuleNotFoundError: No module named 'codecs'
here is my setup.py code:
import cx_Freeze
import sys
import os
import matplotlib
os.environ['TCL_LIBRARY'] = "C:\\LOCAL_TO_PYTHON\\Python35-32\\tcl\\tcl8.6"
os.environ['TK_LIBRARY'] = "C:\\LOCAL_TO_PYTHON\\Python35-32\\tcl\\tcl8.6"
base = None
if sys.platform == 'win32':
base='Win32GUI'
executables = [cx_Freeze.Executable("StatisticsCalculator.py", base=None)]
cx_Freeze.setup(
name="This is a tes",
options = {"build_exe": {"packages":["numpy"]}},
version = "0.01",
description = "Trying to get this to work",
executables = executables
)
and I do not know if it helps, but here are the modules I use in my python program:
import sqlite3
from math import pow, sqrt
from tkinter import Tk, Label, Listbox, END, Button, Message, messagebox
import matplotlib.pyplot as plt
I have python 3.6.3 and I am running Windows 10. Any response would be appreciated.
This is a known issue with cx_Freeze which has been resolved in the source. A new release (5.1.1) will be out shortly to correct that issue!
guys
I recently heard about PyQt4 and decided I should give it a try, however, importing gave me some errors. When I tried importing QtCore and QtGui, I received this error:
from PyQt4 import QtCore, QtGui
ImportError: DLL load failed: The specified module could not be found.
I am using python 3.6.0 on my windows 32 bit computer
I installed pyqt4 by using
pip install pyqt4-4.11.4-cp36-cp36m-win32.whl
To solve this problem I looked into my site-packages and I did see
You should use PyQt5. I know it doesn't have QWebView, but it has a extra module called QWebEngineView. You can install it by running this in the terminal:
pip install PyQtWebEngine. This is the code I use:
import sys
from PyQt5.QtCore import *
from PyQt5.QtWebEngineWidgets import *
from PyQt5.QtWidgets import QApplication
url = "https://stackoverflow.com/"
app = QApplication(sys.argv)
web = QWebEngineView()
web.load(QUrl(url))
web.setZoomFactor(2)
web.zoomFactor()
web.show()
sys.exit(app.exec_())
I've successfully installed Qt4.7.3, Python 3.2, SIP, & PyQt4. Or I think I do? I can
import PyQt4
without any issues but when I try to run this:
#!/usr/bin/env python3
import sys
from PyQt4 import QtGui
app = QtGui.QApplication(sys.argv)
widget = QtGui.QWidget()
widget.resize(250, 150)
widget.setWindowTitle('simple')
widget.show()
sys.exit(app.exec_())
I get this error:
Traceback (most recent call last):
File "./simple.py", line 6, in <module>
from PyQt4 import QtGui
ImportError: cannot import name QtGui
I've checked the paths and they seem to be fine but when looking for the components I can't find them? I do have libQt.a and libQtCore.a where I assume those components would be. I just can't seem to access them.
Any ideas?
Thanks.
If you use #!/usr/bin/env python3 you can not be sure which version of python starts up. For testing you should directly use python3.2!
Since import PyQt4 works and from PyQt4 import QtGui not, it is likely that the files in the PyQt4 module directory are misplaced.
The QtGui.so file needs to resist directly in the PyQt4 directory!
On GNU Systems this directory can be found at /usr/lib/python3/dist-packages/PyQt4/ and on Windows at %SystemDrive%23/Python32/Lib/site-packages/PyQt4/.
This might help finding the directory on Mac OS:
import PyQt4
print(PyQt4.__file__)