Qt Designer使用Python 3.5而不是Python 3.7
Qt Designer using Python 3.5 instead of Python 3.7
我正在使用在python 3到PyQt5上编写的Qt Designer自定义小部件,我不得不使用一个需要更新的sip API的资源文件,但为了做到这一点,我必须更新我的python。
我在 ubuntu 16.04 LTS 上,所以我刚刚从 python.org 下载了 python,就是这样,一切都没有问题,我设法安装 python 3.7 没有问题,如果我在 bash 中使用"python3"命令,python 3.7 环境运行良好。
但是当我执行Qt设计器时,我收到以下错误:
Traceback (most recent call last):
File "/home/ron/Qt/5.11.0/gcc_64/plugins/designer/python/QRoundProgressBarplugin.py", line 3, in <module>
from PyQt5.QtGui import QIcon
ImportError: /usr/local/lib/python3.5/dist-packages/PyQt5/QtGui.so: undefined symbol: PySlice_AdjustIndices
Traceback (most recent call last):
File "/home/ron/Qt/5.11.0/gcc_64/plugins/designer/python/analogclockplugin.py", line 26, in <module>
from PyQt5.QtGui import QIcon, QPixmap
ImportError: /usr/local/lib/python3.5/dist-packages/PyQt5/QtGui.so: undefined symbol: PySlice_AdjustIndices
Traceback (most recent call last):
File "/home/ron/Qt/5.11.0/gcc_64/plugins/designer/python/counterplugin.py", line 3, in <module>
from PyQt5.QtGui import QIcon
ImportError: /usr/local/lib/python3.5/dist-packages/PyQt5/QtGui.so: undefined symbol: PySlice_AdjustIndices
Traceback (most recent call last):
File "/home/ron/Qt/5.11.0/gcc_64/plugins/designer/python/ledplugin.py", line 3, in <module>
from PyQt5.QtGui import QIcon
ImportError: /usr/local/lib/python3.5/dist-packages/PyQt5/QtGui.so: undefined symbol: PySlice_AdjustIndices
Traceback (most recent call last):
File "/home/ron/Qt/5.11.0/gcc_64/plugins/designer/python/manometerplugin.py", line 3, in <module>
from PyQt5.QtGui import QIcon
ImportError: /usr/local/lib/python3.5/dist-packages/PyQt5/QtGui.so: undefined symbol: PySlice_AdjustIndices
Traceback (most recent call last):
File "/home/ron/Qt/5.11.0/gcc_64/plugins/designer/python/switchplugin.py", line 3, in <module>
from PyQt5.QtGui import QIcon
ImportError: /usr/local/lib/python3.5/dist-packages/PyQt5/QtGui.so: undefined symbol: PySlice_AdjustIndices
Traceback (most recent call last):
File "/home/ron/Qt/5.11.0/gcc_64/plugins/designer/python/thermometerplugin.py", line 3, in <module>
from PyQt5.QtGui import QIcon
ImportError: /usr/local/lib/python3.5/dist-packages/PyQt5/QtGui.so: undefined symbol: PySlice_AdjustIndices
当然,正如你所看到的,Qt Designer使用的是python 3.5的lib,所以无法找到最新的PyQt5(5.11(上存在的符号PySlice_AdjustIndices,但是在/usr/local/lib上我有python3.5和python3.7文件夹,每个文件夹都有一个PyQt5版本,但我真的不知道Qt Designer如何指向该文件夹而不是python3.7文件夹, 知道怎么做吗?
而且,只是为了让它知道,很明显,当Qt Designer加载python自定义小部件时会出现问题,我真的不记得我从哪里得到我的 libpyqt5.so(C++小部件告诉设计师如何阅读python小部件(,但我在我最近的PyQt5安装中找不到它,也许那个插件指向该文件夹。
任何提示或帮助?
尝试在文件顶部插入以下内容:
import os,sys
sys.path.insert(1,'/usr/local/lib/python3.7/dist-packages')
在你的 Python 文件的顶部;可能是一个变通方法?
相关文章:
- 如何运行位于boost/libs/python/example/tutorial目录中的hello.cpp和Jamfil
- Pybind11:将元组列表从Python传递到C++
- 如何在c++中使用引用实现类似python的行为
- 是否可以通过C++扩展强制多个python进程共享同一内存
- 递归列出所有目录中的C++与Python与Ruby的性能
- IPC使用多个管道和分支进程来运行Python程序
- 从python中调用C++函数并获取返回值
- Python 3.7 和 excess_args 的 SWIG 问题
- Python中的for循环与C++有何不同
- 使用Pybind11向Python公开Eigen::张量
- Python str to C++ to Python str
- 如何使用Python从C++中读取谷物序列化数据
- 如何在C++中使用pybind11加载一个pickle python列表
- 如何在c++中使用system()来运行包含空格的python脚本
- python集合的C++等价物是什么.计数器
- 如果C++对象的类在另一个boost模块中声明,如何使用boost将指向该对象的指针返回到python
- 从python调用openMP共享库时,未定义opnMP函数
- Qt Designer使用Python 3.5而不是Python 3.7
- 使用C++,如何在Qt Designer中运行python文件
- 如何在Qt Designer(Python)中创建弹出窗口(将主窗口与对话框链接)