[英]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
. openpyxl
是pandas
的可选依赖项,这就是安装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.