0
Problem to import module
Hi, I am lost about something that never happen before... It's about importing modules. >>>import numpy as np ModuleNotFoundError: No module named 'numpy' >>>import nltk ModuleNotFoundError: No module named 'nltk' Does someone has an easy way to correct this ?
12 Respuestas
+ 2
I found the solution thank you Slick for your answer.
The problem was my old pip version.
$ python3.9 -m pip install --upgrade pip
$ pip3.9 install numpy
$ pip3.9 install nltk
+ 1
yeah, go to the command line and type:
pip install numpy
where are you doing this btw?
+ 1
Okay, i don't work with it. I'd start here though:
https://pypi.org/project/tensorflow/#data
0
Among other I have the same problem with tensorflow.. but,
"$ pip3.9 install tensorflow"
doesn't work.
>>>import tensorflow as tf
ModuleNotFoundError: No module named 'tensorflow'
Help please 🙏
0
im still not sure where you're doing this, but:
pip install tensorflow
is the command
0
Ok tensorflow is successfully installed.
>>> import os
>>> print(os.getcwd())
/Users/Groguu/Desktop/Python2021/chatBot
That is where I am with my IDLE Shell 3.9.2
0
Cool stuff
0
Thanks Slick, just I still can't
>>> import tensorflow
0
I think it can't works on python3.9 for the moment it's only usable with python3.8 max. In that case could you tell me what code I have to write in order to change the version of python. So if I can switch to version 3.8 maybe it will work 🤔
0
All you'd have to do is go to the python website and download the older version of python. Then, in your code, add a she bang (#!) with the path to whatever version of python you want to use and the code will run default with that version of python
0
Ok super 👌Do I have to understand that my code can contain different versions of python ? I mean, if I have a program, does this program could work by using different versions of python running in the same time ?
0
Sadly not at the same time... unless you make different modules that use different versions of python. Most are pretty portable since 2.7. But that version and before requires some modification to make it work with python 3.x.