欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Fix PySide 导入问题 No module named ‘PySide‘

程序员文章站 2022-05-28 22:27:35
...

遇到的问题

本文基于python3.6

from PySide.QtCore import QThread
ModuleNotFoundError: No module named 'PySide'

分析1
···

pip install pyqt5
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Requirement already satisfied: pyqt5 in c:\users\tony\pycharmprojects\pythonproject1\venv\lib\site-packages (5.15.4)
Requirement already satisfied: PyQt5-sip<13,>=12.8 in c:\users\tony\pycharmprojects\pythonproject1\venv\lib\site-packages (from pyqt5) (12.9.0)
Requirement already satisfied: PyQt5-Qt5>=5.15 in c:\users\tony\pycharmprojects\pythonproject1\venv\lib\site-packages (from pyqt5) (5.15.2)
···
结论 不行
分析2
···
pip install PySide
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting PySide
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/36/ac/ca31db6f2225844d37a41b10615c3d371587677efd074db29855e7035de6/PySide-1.2.4.tar.gz (9.3 MB)
|████████████████████████████████| 9.3 MB 1.1 MB/s
ERROR: Command errored out with exit status 1:
command: ‘c:\users\tony\pycharmprojects\pythonproject1\venv\scripts\python.exe’ -c ‘import io, os, sys, setuptools, tokenize; sys.argv[0] = ‘"’"‘C:\Users\tony\AppData\Local\Temp\pip-install-ut3flpv2\pyside_97191846f6b348
4e950db4f0c7c07183\setup.py’"’"’; file=’"’"‘C:\Users\tony\AppData\Local\Temp\pip-install-ut3flpv2\pyside_97191846f6b3484e950db4f0c7c07183\setup.py’"’"’;f = getattr(tokenize, ‘"’"‘open’"’"’, open)(file) if os.path.ex
ists(file) else io.StringIO(’"’"‘from setuptools import setup; setup()’"’"’);code = f.read().replace(’"’"’\r\n’"’"’, ‘"’"’\n’"’"’);f.close();exec(compile(code, file, ‘"’"‘exec’"’"’))’ egg_info --egg-base ‘C:\Users\tony\AppDa
ta\Local\Temp\pip-pip-egg-info-yq4uvzn6’
cwd: C:\Users\tony\AppData\Local\Temp\pip-install-ut3flpv2\pyside_97191846f6b3484e950db4f0c7c07183
Complete output (1 lines):
only these python versions are supported: [(2, 6), (2, 7), (3, 2), (3, 3), (3, 4)]
----------------------------------------

···
结论: 不行
分析3

>pip install python3-pyside
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
ERROR: Could not find a version that satisfies the requirement python3-pyside (from versions: none)
ERROR: No matching distribution found for python3-pyside

结论: 不行
分析4

>pip install pyside2
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting pyside2
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/81/73/830023aa8f06d9b04bf45146fd95f1a0f8644f196713fe98bc678e35ab6c/PySide2-5.15.2-5.15.2-cp35.cp36.cp37.cp38.cp39-none-win_amd64.whl (136.3 MB)
     |████████████████████████████████| 136.3 MB 35 kB/s
Collecting shiboken2==5.15.2
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/85/c2/49578ee1912e06e4f4ffb2cf974b4ee864f6d81bcb3961bc8b96de021cbd/shiboken2-5.15.2-5.15.2-cp35.cp36.cp37.cp38.cp39-none-win_amd64.whl (2.3 MB)
     |████████████████████████████████| 2.3 MB 1.1 MB/s
Installing collected packages: shiboken2, pyside2
Successfully installed pyside2-5.15.2 shiboken2-5.15.2

结论 不行:
分析5

#from PySide.QtCore import QThread
#from PySide.QtCore import Signal
from PyQt5.QtCore import QThread
from PyQt5.QtCore import pyqtSignal

结论 :可以替代

总结

QT在python3.6使用中 使用pyqt5模块
进一步确认正在进行中