简体   繁体   English

如何安装特定 python package 的所有依赖项?

[英]How can I install all dependencies for a specific python package?

When I install some python packages, pandas for example, I'd like to use the following command:当我安装一些 python 包时,例如pandas ,我想使用以下命令:

conda install pandas

This does install some denpendencies of pandas , BUT NOT ALL!这确实安装了pandas的一些依赖项,但不是全部!

When I run the following code:当我运行以下代码时:

import pandas as pd

df = pd.DataFrame()
df.to_excel('a_excel_file.xlsx')

It gives me errors:它给了我错误:

Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "D:\Miniconda\envs\to_be_deleted2\lib\site-packages\pandas\core\generic.py", line 2181, in to_excel
    engine=engine,
  File "D:\Miniconda\envs\to_be_deleted2\lib\site-packages\pandas\io\formats\excel.py", line 726, in write
    writer = ExcelWriter(stringify_path(writer), engine=engine)
  File "D:\Miniconda\envs\to_be_deleted2\lib\site-packages\pandas\io\excel\_openpyxl.py", line 18, in __init__
    from openpyxl.workbook import Workbook
  File "D:\PyCharm Professional 2019.1.3\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
ModuleNotFoundError: No module named 'openpyxl'

Looks like openpyxl were not installed as the installation of pandas .看起来openpyxl没有安装为pandas的安装。 Why that happended?为什么会这样? How to fix it?如何解决?

openpyxl is an optional dependency of pandas , this is the reason why it wasn't installed when you installed pandas . openpyxlpandas可选依赖项,这就是安装pandas时没有安装它的原因。

pandas has many such optional dependencies which add useful, but not core, features - see the installation documentation for a complete list. pandas有许多这样的可选依赖项,它们添加了有用的但不是核心的功能 - 请参阅安装文档以获取完整列表。

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

相关问题 Python:我怎么知道我的哪个依赖项正在尝试安装特定的 package? - Python : how can I know which one of my dependencies is attempting to install a specific package? 如何将包含所有依赖项的python包安装到Docker镜像中? - How to install a python package with all the dependencies into a Docker image? 如何创建一个包来安装所有依赖python脚本的需求 - How to create a package to install all the dependencies python script needs 如何列出特定文件夹/包的所有 Python 要求? - How can I list all Python requirements for a specific folder/package? 在使用Anaconda依赖项时如何安装PyPI软件包? - How can I install a PyPI package while using Anaconda dependencies? 如何让 pipenv 安装 package 子依赖项 - how can I get pipenv to install package sub dependencies 如何安装自定义的依赖项 python package - How to install dependencies of a custom python package 我如何在 python 中安装 ipsec package - how can i install ipsec package in python 我可以为所有用户安装python软件包(在开发模式下使用setuptools) - Can I install a python package for all users (with setuptools in develop mode) conda可以在全球范围内安装软件包还是将所有软件包都安装到特定的环境? - Can conda install package globally or are all package installed to a specific environment?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM