PyCharm not recognizing PyQT4 and PyQt4 not allowing me to 'view code'

Dennis

I am a beginner and have 2 issues, which may be related to each other. 1. I am using PyCharm, and when I put "from PyQt4 import QtCore, QtGui, uic" I get a red line under each word (except from & import) saying "unresolved reference".

  1. I have PyQ4/Designer installed (I know it is because I have made a GUI), but when I click 'view code' for the GUI, it says "unable to launch C:/Python34/Lib/site-packages/PyQt4\uic"

Maybe a path issue??? Like I said, I am very new to Python/Qt and really do not know how to check the path and/or change it if it is wrong. I downloaded Python 3.6.0, PyChamr2016.3.2, Qt4.8.7

titusjan

Since you do seem to have PyQt installed my guess is that you have multiple Python versions installed (version 3.4 and version 3.6) and that PyQt is only installed under 3.6, but that PyCharm and the Designer are configured to use 3.4.

I don't know how to change the Python interpreter in the Qt Designer as I never use it. However in PyCharm open the settings and look for the "Project Interpeter" tab. There you can configure the default Python interpreter that is used for your project. It even shows the installed packages for that interpreter.

When you run a Python program from PyCharm, the first line in the output shows which Python interpreter was used. This way you can check if it is as expected. If it is still not correct, it can be that you have overridden it in your Run Configuration. Select "Edit Configuration" from the "Run" menu. This will open a dialog with Run Configuration settings for the Python script that you last executed. Check the "Python Interpreter" there and change it if needed.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related