繁体   English   中英

litstudy 包安装 Python

[英]litstudy Package Installation Python

我正在尝试进行 Co-Citation Network 分析,并且必须在 Python 中安装名为“litstudy”的包,但在 Jupyter 和 Python 3.10 中安装它时出现错误

litstudy 包的链接https://nlesc.github.io/litstudy/index.html

在 Python 3.10 中,从命令提示符安装时出现错误

C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.32.31326\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2 [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. error: legacy-install-failure

它安装在 Jupyter 中,但是当我导入包时出现错误

 import litstudy   
 Traceback (most recent call last):

 File "C:\Users\vibhu\AppData\Local\Programs\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\IPython\core\interactiveshell.py", line 3437, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)

File "<ipython-input-2-b5a65b8eaed7>", line 1, in <module>
import litstudy

File "C:\Users\vibhu\AppData\Local\Programs\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\litstudy\__init__.py", line 1, in <module>
from .sources import *  # noqa: F403,F401


  File "C:\Users\vibhu\AppData\Local\Programs\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\litstudy\sources\__init__.py", line 1, in <module>
from .scopus import search_scopus, refine_scopus, fetch_scopus

 File "C:\Users\vibhu\AppData\Local\Programs\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\litstudy\sources\scopus.py", line 236
if doi := id.doi:

如果有人可以为我解决这个问题,我将非常感激我被困在这个问题上,并且需要开始网络分析,或者如果你有任何其他类似的 Citation Networking 解决方案

TL;博士

  • litstudy 包的依赖项与 Python 3.10 不兼容,您必须降级到 3.9
  • 使用 conda 从 conda-forge 安装软件包,因此您不必编译它们。

漫长的故事

litstudy包有大量的依赖项,其中有几个需要编译。 您收到的错误消息表明其中某些人的编译失败。

当我运行pip install litstudy以重现您的问题时,依赖wordcloudfa2在我的计算机上出现问题。

对于wordcloud ,存在一个预编译的 Conda 包,可从conda-forge forge 获得。 我建议使用 conda(Anaconda3 或 Miniconda3 都可以)。

这适用于 wordcloud,正如它自己的自述文件所推荐的那样:

conda install -c conda-forge wordcloud

对于fa2 ,还有第二个问题:当我运行conda install -c conda-forge fa2时,我收到了这条消息:

UnsatisfiableError: The following specifications were found
to be incompatible with the existing python installation in your environment:

Specifications:

  - fa2 -> python[version='>=3.6,<3.7.0a0|>=3.7,<3.8.0a0|>=3.8,<3.9.0a0|>=3.9,<3.10.0a0']

Your python: python==3.10.4

这基本上说fa2与 Python 3.10 不兼容(尚)。 因此,您必须降级到 Python 的 3.9.x 版本才能使用此包。

因此,为了安装litstudy及其依赖项,我刚刚使用 conda 创建了一个 Python 3.9.12 环境,然后就可以安装所有内容了。

可剪切粘贴的解决方案

把它们放在一起,这对我有用,在安装 Miniconda3 之后:

conda create -n py39 python==3.9.12
conda activate py39
conda install -c conda-forge fa2 wordcloud
pip install litstudy

在那种环境下, import litstudy可以正常工作。

暂无
暂无

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM