python与linux关系_如何处理Linux / Python依赖关系?
由于缺乏對我想使用的一些庫的支持,我將一些
Python開發(fā)從Windows轉(zhuǎn)移到Linux開發(fā).我已經(jīng)花了大部分時(shí)間搞亂了依賴關(guān)系.
問題
每當(dāng)我拿起Linux,我通常會遇到一些依賴問題,通常是開發(fā)庫,無論是通過apt-get,easy_install或pip安裝.我可以浪費(fèi)時(shí)間,應(yīng)該是簡單的任務(wù),花更長的時(shí)間讓圖書館工作,而不是編寫代碼.在哪里可以了解處理這些問題的策略,而不是為了遇到同樣問題的人而無緣無盡地搜索?
一個(gè)例子
所以,我發(fā)現(xiàn)在pypi的包,并認(rèn)為使用這將使生活更輕松:
(我可能通過使用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之前的某個(gè)時(shí)間點(diǎn).)
所以我試圖運(yùn)行測試腳本:
(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,但是似乎沒有一個(gè)可以幫助我,而不是把我送回來.
(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雖然.現(xiàn)在我被困了,是ImageOps從枕頭丟失,還是一個(gè)不同的問題,也是在那里與pil.
總結(jié)
以上是生活随笔為你收集整理的python与linux关系_如何处理Linux / Python依赖关系?的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: linux怎么创建vi脚本,Vim 创建
- 下一篇: linux查看.ssh权限,linux查