您好我打算使用AWS lambda,我需要打包我的依賴庫。他們建議的方式是使用pip install --target
將所有依賴關係加載到一個位置並在稍後進行捆綁。pip安裝到目標目錄失敗
但是,我正在嘗試使用PIL庫來處理jpgs,我正在使用枕頭,這是PIL的主動維護叉。
這是我做了什麼,使其工作:
$ virtualenv env
$ source env/bin/activate
(env)$ pip install pillow
...
changing mode of /home/~/lambdaEnv/bin/pilconvert.py to 775
changing mode of /home/~/lambdaEnv/bin/pilprint.py to 775
Successfully installed pillow-3.0.0
(env)$ python
Python 2.6.6 (r266:84292, Nov 21 2013, 10:50:32)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from PIL import Image
>>>
和它的工作完美,但是,當我使用target
它以一種不可思議的方式出錯了。誰可以幫我這個事?
...
changing mode of /tmp/tmpbbKMTP/bin/pilconvert.py to 775
changing mode of /tmp/tmpbbKMTP/bin/pilprint.py to 775
Successfully installed pillow-3.0.0
Exception:
Traceback (most recent call last):
File "/home/~/lambdaEnv/lib/python2.6/site-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/home/~/lambdaEnv/lib/python2.6/site-packages/pip/commands/install.py", line 390, in run
for item in os.listdir(lib_dir):
OSError: [Errno 2] No such file or directory: '/tmp/tmpbbKMTP/lib/python/'
最後在目標目錄中沒有任何東西。
在與'MySQL-python'相同的情況下得到相同的錯誤 –