如何在虚拟环境中安装 SIP 和 PyQt? [英] How to install SIP and PyQt on a virtual environment?

查看:72
本文介绍了如何在虚拟环境中安装 SIP 和 PyQt?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 virtualenv 的新手.我想安装spyder,需要PyQt4,需要SIP.

I am new to virtualenv. I want to install spyder, which require PyQt4, which requires SIP.

pip 不起作用,所以我下载了 SIP,并执行了以下命令:

pip doesn't work, so I downloaded SIP, and I did the following commands:

python configure.py
make
make install

但是我收到了这个错误:

But I received this error:

make[1]: entrant dans le répertoire « /stck2/stck2.2/ptoniato/python/pip/virtualenv-1.10.1/provaenv/build/SIP/sipgen »
cp -f sip /stck2/stck2.2/ptoniato/python/pip/virtualenv-1.10.1/provaenv/bin/sip
make[1]: quittant le répertoire « /stck2/stck2.2/ptoniato/python/pip/virtualenv-1.10.1/provaenv/build/SIP/sipgen »
make[1]: entrant dans le répertoire « /stck2/stck2.2/ptoniato/python/pip/virtualenv-1.10.1/provaenv/build/SIP/siplib »
cp -f sip.so /stck2/stck2.2/ptoniato/python/pip/virtualenv-1.10.1/provaenv/lib/python2.7/site-packages/sip.so
strip /stck2/stck2.2/ptoniato/python/pip/virtualenv-1.10.1/provaenv/lib/python2.7/site-packages/sip.so
cp -f /stck2/stck2.2/ptoniato/python/pip/virtualenv-1.10.1/provaenv/build/SIP/siplib/sip.h /usr/local/python/include/python2.7/sip.h
cp: impossible de supprimer « /usr/local/python/include/python2.7/sip.h »: Permission non accordée
make[1]: *** [install] Erreur 1
make[1]: quittant le répertoire « /stck2/stck2.2/ptoniato/python/pip/virtualenv-1.10.1/provaenv/build/SIP/siplib »
make: *** [install] Erreur 2

Impossible de supprimer 意味着无法擦除.

Impossible de supprimer means Impossible to erase.

我没有这台电脑的 root 访问权限.我认为这台电脑上默认安装的 python 包和我正在创建的 virtualenv 之间存在冲突.

I have no root access to this pc. I think that's there is a conflict between the python package that is installed by default on this pc and the virtualenv that I am creating.

我该如何解决问题?

推荐答案

以下是我在 virtualenv 中安装 sip 的步骤.诀窍是确保您使用(未记录?)--always-copy 标志,以便它不只是 symlink /usr/include/python2.7 目录到您的 virtualenv 中.

Here are the steps I used to install sip in my virtualenv. The trick is to make sure that you use the (undocumented?) --always-copy flag, so that it doesn't just symlink the /usr/include/python2.7 directory into your virtualenv.

virtualenv --always-copy ve
. ve/bin/activate
wget http://sourceforge.net/projects/pyqt/files/sip/sip-4.15.4/sip-4.15.4.zip
unzip sip-4.15.4.zip
cd sip-4.15.4
python configure.py --incdir=../ve/include/python2.7
make
make install
cd ..

然后我就可以像这样安装 PyQt4:

I was then able to install PyQt4 like so:

wget http://sourceforge.net/projects/pyqt/files/PyQt4/PyQt-4.10.3/PyQt-x11-gpl-4.10.3.tar.gz
tar zxvf PyQt-x11-gpl-4.10.3.tar.gz
cd PyQt-x11-gpl-4.10.3
python configure.py
make
make install

这在最后确实给出了一个错误,但它被忽略了.我认为这只是安装设计器"的一部分,并不重要.

This did give an error at the end, but it was ignored. I think this is just part of installing 'designer' which isn't critical.

install: cannot create regular file `/usr/lib/x86_64-linux-gnu/qt4/plugins/designer/libpyqt4.so': Permission denied
make[1]: [install_target] Error 1 (ignored)

这篇关于如何在虚拟环境中安装 SIP 和 PyQt?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆