Why can't I call pip with --target and --edita

2019-06-01 19:53发布

I'm using

cd MyPackage

pip install --target deploy_directory .

to prepare packages for deployment on Google App Engine, but for testing under dev_appserver.py, I would like to install the package in development mode (i.e., with '--editable'). However, when I try:

cd MyPackage

pip install --target deploy_directory --editable .

I get something like:

Complete output from command /my/venv/bin/python -c "import setuptools, tokenize;__file__='/Path/To/MyPackage/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" develop --no-deps --home=/var/folders/5h/k2xt_l014s1c1gvmnssm963c0000gp/T/tmpoml8u3:
/my/venv/lib/python2.7/site-packages/setuptools/dist.py:364: UserWarning: Normalizing '0.1.0
' to '0.1.0'
  normalized_version,
usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
   or: -c --help [cmd1 cmd2 ...]
   or: -c --help-commands
   or: -c cmd --help

error: option --home not recognized

Which seems to happen because 'setup.py develop' doesn't accept '--home'.

Here's my setup.py:

 from setuptools import setup, find_packages
 import os
 import sys
 from codecs import open

  setup(name="MyModule",
        version="0.1.0",
        long_description="Blah blah",
        author="Me",
        packages = find_packages()
  )

How can I easily work on code that running under the development server?

1条回答
仙女界的扛把子
2楼-- · 2019-06-01 20:50

This is known to be broken since a long time. See https://github.com/pypa/pip/issues/3246 and https://github.com/pypa/pip/issues/562.

In the second link it is mentioned that some developers covered their use case with replacing --target by --src. I have not tried this myself though.

查看更多
登录 后发表回答