我已经安装了nodejs应用程序所需的所有Node.js库。但后端的nodejs应用程序使用python库,其中包含一些代码行,如import nltk和所有其他库。这些导入语句在上传到heroku平台时会引发错误。
Traceback (most recent call last): File "mainfile.py", line 2, in import functionfile as f File "/app/functionfile.py", line 1, in import nltk ModuleNotFoundError: No module named 'nltk'
我已经上传了所有的文件,但它仍然引发一个错误。
部署在heroku上的完整代码可在github link - https://github.com/rinku16/patranker中找到
app文件夹中存在nodejs应用程序代码文件
问题:如何在我的应用程序中使用这个nltk和其他python库。
以下是python文件中所需的python库
# Import function file as reference to use defined python functions
import functionfile as f
import sys
import nltk
from nltk.corpus import stopwords
#for generating sentence token
from nltk.tokenize import sent_tokenize
#for generating word token
from nltk.tokenize import word_tokenize
# BeautifulSoup for scraping and Requests to make HTTP requests.
from bs4 import BeautifulSoup
# BeautifulSoup is in bs4 package
import requests
#Counter class For Getting Most Occurred Biwords
from collections import Counter
#FOR MAKING DATA FRAME AND WRITING THE PATENT EXTRACTED DATA TO CSV FILE
from pandas import DataFrame
import pandas as pd
import os
import os.path
from os import path
import re
from datetime import datetime, timedelta
from datetime import date
import math例如,对于nltk库,下面是我获取的文件的路径
>>> import nltk
>>> nltk.__file__ 'C:\\Users\\Carthaginian\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\nltk\\__init__.py'如何使用此路径在nodejs应用程序中克隆它。请看这个。
https://stackoverflow.com/questions/66381989
复制相似问题