Comments (4)
你好,我在跑这个代码的时候遇到了一个问题,报错为 ImportError: cannot import name 'pad_sequences' from 'data' (P:\Anaconda3\lib\site-packages\data__init__.py) 是不是我的data版本问题呀
这应该是Python比较常见的包导入问题,import ner.data.pad_sequences as pad_sequences可以试试,相对导入和绝对导入,如果用的pycharm,试着把这个 mark dictionary as Source Root。不行的话可以上网查一下。实在不行把data.py移动到main.py同一级目录。
from ccks2019-task5.
你好,刚刚去吃午饭了,完整的报错是这样的
Traceback (most recent call last):
File "D:/Course/qwe-master/main.py", line 10, in
from ner.model import BiLSTM_CRF
File "D:\Course\qwe-master\ner\model.py", line 9, in
from data import pad_sequences,batch_yield
ImportError: cannot import name 'pad_sequences' from 'data' (P:\Anaconda3\lib\site-packages\data_init_.py)
from ccks2019-task5.
谢谢大佬 果然是路径问题 第一次跑项目好多报错 可以问一下你是用什么跑的嘛 pycharm这个路径要改的话好麻烦
from ccks2019-task5.
以前用的pycharm跑,应该是没啥问题的,你可以查一下绝对import和相对import,好像可以写个 __init__.py
``放ner目录下。或者暴力点,把所有.py放同一个目录,基本能解决大部分import的问题。还有种方法, sys.path.append(['./','./ner'])
不一定是这么写,但是这个意思,你可以查一下
from ccks2019-task5.
Related Issues (2)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ccks2019-task5.