I made a module named 'calc' and installed it using the following command in cmd:
py -3 -m pip install calc-2.1.tar.gz.
I can import the module and use it when I run python in cmd.
Yet, anywhere else, it doesn't work. Both IDLE and Anaconda raise ModuleNotFoundError.
The same goes for other modules I try to install.
By the way, I'm really new to python, so could you please be a bit more specific with the instructions?
Ok, I figured out what the problem was.
I was using different versions of python (3.7 in IDLE, 3.8 in Spyder, 3.9 in cmd) which is why the module installed by cmd didn't work other places.
Related
I'm trying to use selenium, but can't get python to recognize it.
I installed it first using "pip install selenium" and "pip install webdriver-manager". It is in the folder "C:\Users\{username}\AppData\Local\Programs\Python\Python310\Lib\site-packages\selenium", but I get the error "ModuleNotFoundError: No module named 'selenium'" when I try to import it.(https://i.stack.imgur.com/dVplU.png)
(https://i.stack.imgur.com/wiREJ.png)
Here it is shown as installed with the command "pip list"
(https://i.stack.imgur.com/QhOu7.png)
I also tried uninstalling it and reinstalling with flags that I saw some people say worked, but it didn't make a difference.
(https://i.stack.imgur.com/VTTMU.png)
I only have one python interpreter version installed, 3.10 (so only one python folder, "Python310"). I have pandas in the same site-packages folder which I can import and use no problem.
If anyone knows what the issue might be, please let me know. I can't figure it out for the life of me.
Okay, I solved the issue by completely uninstalling the interpreter which I got from the Microsoft Store and reinstalling it from the official Python website. Now "from selenium import webdriver" works.
Somehow selenium installed in the global scope is not getting recognized within the Virtual Environment of VS Code / PyCharm.
Solution
You need to install Selenium within the Virtual Environment.
Within the Terminal execute the command:
pip install -U selenium
So I'm using vscode and I installed python, I changed my python interpreter to Python 3.1 which I assumed would change the Python version to 3.1 as well? But when I type python --version it still says 2.7.18... And I also installed pygame using "python3 -m pip install -U pygame --user" in my terminal but still when I try to run this any file that imports pygame it says ImportError: No module named pygame
Other people have said they have the same problem and maybe I'm missing something but their solutions didn't work for me?
I've installed matplotlib through pip, and it runs perfectly when I use it in PyCharm. However, when I run my Python file through cmd, I get the following error message:
ModuleNotFoundError: No module named 'matplotlib'
I have installed other modules the same way, and those have no problems running in PyCharm or in cmd.
Matplotlib is installed under:
C:\Users\David\appdata\local\programs\python\python38-32\lib\site-packages
Something I noticed - perhaps the root of the problem - Is that Python seems to be installed in 2 places:
C:\Users\David\AppData\Local\Programs\Python\Python38-32\python.exe
The path above is also the path to my Python Interpreter on PyCharm.
and
C: \Users\David\AppData\Local\Microsoft\WindowsApps\python.exe
Python version 3.8.5
Windows 10
Thanks in advance!
try running the command pip install matplotlib in your cmd. It works for me.
I am trying to install modules like tkinter, bs4 and numpy.
I use cmd and pip to install them, and it says that everything is installed fine.
When I am using Visual Studio code it says
ModuleNotFoundError: No module named '....'
How can I find out if Python and the modules are in the same PATH?
Or what can i do to fix that?
I've tried to reinstall Python, but I get the same error.
Is it just the VSC?
File "c:/Users/Γιώργος Μαργα/Desktop/test.py", line 1, in <module>
import numpy
ModuleNotFoundError: No module named 'numpy'
pip install is most likely installing globally into a Python interpreter that is different than the one that you have selected in VS Code.
if vscode not recognize your modules try to reload vscode.
install modules with
python3 -m pip install {new_module}
and then reload your Vs code
make sure to set your Python interpreter within VSCode to the same as the one in your system path pythoninvscode
Ok so i uninstall python and installed it again but this time i checked the box that said add that to PATH or someithng like this.
I also uninstalled python from the windowsstore however when it ry to run a code in VSC it doesnt do anything
I'm in Win10 and use vanilla Python 3.7.3 (e.g. not conda or anything). I had a successful pip install for the package, the package shows up in pip freeze, and the package is supposed to be compatible with my version of Python. I've seen several threads with similar issues on OS X and Linux, and have tried to emulate their solutions on Windows, but no luck. I'm guessing it could be an issue with my PATH variable, but I'm not quite sure. The error I get when trying to import is the "No module named" error.
Went into site-packages...for some reason the module was named Bio there (everywhere else it's named biopython, again, including pip freeze) and importing that worked. Not sure if this was just a bad dev choice or what.