您好我打算使用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'相同的情况下得到相同的错误 –