简体   繁体   English

pip未安装依赖项

[英]Dependencies are not installed by pip

I have a library with the following setup.py : 我有一个带有以下setup.py的库:

from setuptools import setup

from mylib import __version__

requirements = ['paramiko']
tests_require = ['pytest']


def main():
    setup(
        name='mypackage',
        description='A collection of utilities',
        url='http://example.net',
        version=__version__,
        author='Me Me',
        author_email='me@me.net',
        packages=['mylib'],
        zip_safe=False,
        install_requires=requirements,
        tests_require=tests_require,
    )

if __name__ == '__main__':
    main()

I have released this package to an internal devpi server. 我已经将此软件包发布到内部devpi服务器。 Whenever I try to install it, I get: 每当我尝试安装它时,都会得到:

» pip install mypackage
Looking in indexes: http://devpi.mine/myuser/dev/+simple/
Collecting mypackage
  Downloading http://devpi.mine/myuser/dev/+f/a8c/c05e3a49de4fe/mypackage-0.0.2.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-ee238ja7/mypackage/setup.py", line 3, in <module>
        from mypackage import __version__
      File "/tmp/pip-install-ee238ja7/mypackage/mylib/__init__.py", line 3, in <module>
        from .storage_host import StoraHostType
      File "/tmp/pip-install-ee238ja7/mypackage/mylib/storage_host.py", line 5, in <module>
        from .ssh import SSH
      File "/tmp/pip-install-ee238ja7/mypackage/mylib/ssh.py", line 5, in <module>
        import paramiko
    ModuleNotFoundError: No module named 'paramiko'

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-ee238ja7/mypackage/

Why is pip not installing the requirements listed in install_requires , in setup.py ? 为什么pip不安装setup.pyinstall_requires中列出的要求?

That is because you are referring your package before setup has been executed. 那是因为您在执行setup程序之前就引用了程序包。

Pip need to first touch setup(...) to do everything. 点子需要先触摸setup(...)以完成所有操作。 But before it, you from mylib import __version__ . 但在此之前,您from mylib import __version__ So setup doesn't execute at all. 因此setup根本不会执行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 pip 重新安装 pkg 并安装未安装的依赖项,但不安装已安装的依赖项? - pip reinstall pkg and install dependencies that are not installed, but not install dependencies that are already installed? Pip已安装的依赖项不适用于应用程序文件 - Pip installed dependencies not available to application file pip 冻结,不依赖已安装的软件包 - pip freeze without dependencies of installed packages 修补Python软件包,通过Pip安装为依赖项 - Patching Python packages, installed as dependencies with Pip pip 从conda环境安装时的依赖关系.yaml - pip dependencies of dependencies when installed from conda environment.yaml 如何卸载与Pip一起安装的Python软件包引入的依赖关系? - How to uninstall dependencies introduced by a Python package installed with Pip? pip:安装依赖项的依赖项 - pip: install dependencies of dependencies 如何在本地安装与在 GCP 上的 Cloud Composer Airflow 环境中安装的相同的 pip 依赖项? - How do I install the same pip dependencies locally as are installed in my Cloud Composer Airflow environment on GCP? 在 pyproject.toml 中指定测试依赖项并使用 pip install -e 安装它们 - Specifying test dependencies in pyproject.toml and getting them installed with pip install -e pip3 未安装 pip - pip3 installed without pip
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM