导入错误:无法从"numpy. typing"导入名称"NDArray"(Prophet)

j2qf4p5b  于 2023-03-02  发布在  其他
关注(0)|答案(1)|浏览(1331)

在我的Python经验中,我在尝试安装任何其他包时都没有遇到过比Prophet更大的麻烦。
下面是我的代码片段:

#Import libraries
import pandas as pd
from prophet import Prophet

#Load data
test = pd.read_csv('https://raw.githubusercontent.com/facebook/prophet/main/examples/example_wp_log_peyton_manning.csv')
test.head()

# Train model
model = prophet()
model.fit(test)

出现以下错误:

----> 4 from prophet import Prophet
      7 # Train model
      8 model = prophet()

File ~/anaconda3/envs/prophet39/lib/python3.9/site-packages/prophet/__init__.py:7
      1 # Copyright (c) 2017-present, Facebook, Inc.
      2 # All rights reserved.
      3 #
      4 # This source code is licensed under the BSD-style license found in the
      5 # LICENSE file in the root directory of this source tree. An additional grant
      6 # of patent rights can be found in the PATENTS file in the same directory.
----> 7 from prophet.forecaster import Prophet
      9 from pathlib import Path
     10 about = {}

File ~/anaconda3/envs/prophet39/lib/python3.9/site-packages/prophet/forecaster.py:17
     15 import numpy as np
     16 import pandas as pd
---> 17 from numpy.typing import NDArray
     19 from prophet.make_holidays import get_holiday_names, make_holidays_df
     20 from prophet.models import StanBackendEnum

ImportError: cannot import name 'NDArray' from 'numpy.typing' (/Users/user_name/anaconda3/envs/prophet39/lib/python3.9/site-packages/numpy/typing/__init__.py)

我不知道如何解决这个问题。我已经遇到了几个不同的prophet/pystan问题的道路上,但似乎我击中了相当大的路障这一次。

相关问题