簡體   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