python与linux关系_如何处理Linux / Python依赖关系?

由于缺乏对我想使用的一些库的支持,我将一些

Python开发从Windows转移到Linux开发.我已经花了大部分时间搞乱了依赖关系.

问题

每当我拿起Linux,我通常会遇到一些依赖问题,通常是开发库,无论是通过apt-get,easy_install或pip安装.我可以浪费时间,应该是简单的任务,花更长的时间让图书馆工作,而不是编写代码.在哪里可以了解处理这些问题的策略,而不是为了遇到同样问题的人而无缘无尽地搜索?

一个例子

所以,我发现在pypi的包,并认为使用这将使生活更轻松:

(我可能通过使用virtualenv来保持整洁,让自己的生活变得更加困难.)

(myenv3)mat@ubuntu:~/myenv3$bin/pip install pyqrencode

Downloading/unpacking pyqrencode

Downloading pyqrencode-0.2.tar.gz

Running setup.py egg_info for package pyqrencode

Installing collected packages: pyqrencode

Running setup.py install for pyqrencode

building 'qrencode' extension

gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c qrencode.c -o build/temp.linux-i686-2.7/qrencode.o

gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions build/temp.linux-i686-2.7/qrencode.o -lqrencode -o build/lib.linux-i686-2.7/qrencode.so

Successfully installed pyqrencode

Cleaning up...

(我想我可能sudo apt-get安装libqrencode-dev之前的某个时间点.)

所以我试图运行测试脚本:

(myenv3)mat@ubuntu:~/myenv3$python test_qr.py

Traceback (most recent call last):

File "test_qr.py", line 1, in

from qrencode import Encoder

File "qrencode.pyx", line 1, in init qrencode (qrencode.c:1520)

ImportError: No module named ImageOps

🙁

那么,investigations透露,ImageOps似乎是PIL的一部分…

(myenv3)mat@ubuntu:~/myenv3$pip install pil

Downloading/unpacking pil

Downloading PIL-1.1.7.tar.gz (506Kb): 122Kb downloaded

Operation cancelled by user

Storing complete log in /home/mat/.pip/pip.log

(myenv3)mat@ubuntu:~/myenv3$bin/pip install pil

Downloading/unpacking pil

Downloading PIL-1.1.7.tar.gz (506Kb): 506Kb downloaded

Running setup.py egg_info for package pil

WARNING: '' not a valid package name; please use only.-separated package names in setup.py

Installing collected packages: pil

Running setup.py install for pil

WARNING: '' not a valid package name; please use only.-separated package names in setup.py

building '_imaging' extension

gcc ...

building '_imagingmath' extension

gcc ...

--------------------------------------------------------------------

PIL 1.1.7 SETUP SUMMARY

--------------------------------------------------------------------

version 1.1.7

platform linux2 2.7.1+ (r271:86832, Apr 11 2011, 18:05:24)

[GCC 4.5.2]

--------------------------------------------------------------------

*** TKINTER support not available

*** JPEG support not available

*** ZLIB (PNG/ZIP) support not available

*** FREETYPE2 support not available

*** LITTLECMS support not available

--------------------------------------------------------------------

To add a missing option, make sure you have the required

library, and set the corresponding ROOT variable in the

setup.py script.

To check the build, run the selftest.py script.

...

Successfully installed pil

Cleaning up...

嗯,PIL的安装,但没有拿起我安装的库sudo apt-get install libjpeg62 libjpeg62-dev libpng12-dev zlib1g zlib1g-dev之前.我不知道如何告诉pip将库位置提供给setup.py. Googling建议我尝试过各种各样的ideas,但是似乎没有一个可以帮助我,而不是把我送回来.

(myenv3)mat@ubuntu:~/myenv3$pip install pillow

Downloading/unpacking pillow

Downloading Pillow-1.7.5.zip (637Kb): 637Kb downloaded

Running setup.py egg_info for package pillow

...

Installing collected packages: pillow

Running setup.py install for pillow

building '_imaging' extension

gcc ...

--------------------------------------------------------------------

SETUP SUMMARY (Pillow 1.7.5 / PIL 1.1.7)

--------------------------------------------------------------------

version 1.7.5

platform linux2 2.7.1+ (r271:86832, Apr 11 2011, 18:05:24)

[GCC 4.5.2]

--------------------------------------------------------------------

*** TKINTER support not available

--- JPEG support available

--- ZLIB (PNG/ZIP) support available

--- FREETYPE2 support available

*** LITTLECMS support not available

--------------------------------------------------------------------

To add a missing option, make sure you have the required

library, and set the corresponding ROOT variable in the

setup.py script.

To check the build, run the selftest.py script.

...

Successfully installed pillow

Cleaning up...

嗯,我们似乎有JPEG和PNG支持这一次,呀!

(myenv3)mat@ubuntu:~/myenv3$python test_qr.py

Traceback (most recent call last):

File "test_qr.py", line 1, in

from qrencode import Encoder

File "qrencode.pyx", line 1, in init qrencode (qrencode.c:1520)

ImportError: No module named ImageOps

仍然没有ImageOps虽然.现在我被困了,是ImageOps从枕头丢失,还是一个不同的问题,也是在那里与pil.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值