I'm currently doing the exercise in "Learn python the hard way".
In this exercise i have to install the lpthw.web frame work.
Having installed pip in windows, i open my terminal and hit
pip install lpthw.web
Everything then ends succesfully.
But when i browse C:\Python27\Lib\site-packages\lpthw.web-1.1-py2.7.egg-info and check the installed-files text i can't see the web.py.
Consequently when i try to import it in a simple script i get ImportError.
I don't have python 3 installed as book suggested for possible cause, so i don't know how to work around it.
Any suggestion?
I checked my path
import sys
sys.path
and saw that every single line was using the panda3d path.
As i was not really using it, unistalling it fixed my problem.
For me it was python version control on raspberry pi
(linux) 2.7 is default and does not work.
follow:
https://learn.sparkfun.com/tutorials/python-programming-tutorial-getting-started-with-the-raspberry-pi/configure-your-pi
have other errors now but the import web loads in python.
cheers!
Related
the problem:
as part of my studies, i have tried to download PyGame for my own independent project. I've currently downloaded 1.9.6, as well as currently owning IDLE version 3.8. i have imported it many times:
folder.
on one occasion , i placed it in its own separate folder with the coding file in another internal folder
when importing it into a new python script, the result was that there was "no module named Pygame", even though it was in a file containing the recent edition (this method was used successfully to download Tkinter).
I also tried making a python script outside the contained folder like this
this,too had the same result.
Any idea what exactly to do?
any more important information
The computer type is a MAC 10.13.6 and the IDE is IDLE. As previously mentioned, the downloaded version is version 1.9.6 and i have not a clue what how many bits my computer manages. Apologies that this is probably one of MILLIONS of the exact same question answered.I've tried at least 2 of these solutions.
First you need to make sure that you have pip installed. Type pip in your cmd (command prompt) and if you get no errors you are fine. If you have errors follow this link to get it. If you are stuck on that link - basically all you need to do is uninstall python and then when you are installing it again tick the box that says:
Add Python 3.5 to PATH
Now just finish installing python.
Next you need to install pygame with pip install pygame in your cmd - run it as administrator just to be safe. If you receive errors try updating pip with python -m pip install --upgrade pip. Now create and save a new python file. Import pygame in that file by using the code import pygame. The output should be:
pygame 1.9.6
Hello from the pygame community. https://www.pygame.org/contribute.html
Now you are free to code in pygame! I hope this helped.
I'm having a problem with importing modules in python.
When I run my program in the command line it works perfectly fine.
However, when I try to run the same program in the python shell I am prompted with the following error:
ModuleNotFoundError: No module named 'matplotlib'
I already successfully installed matplotlib using 'python -m pip install matplotlib'.
I've read this can happen when you have two different versions of python installed; however, I don't.
I've uninstalled and reinstalled python and I still am having the same issue. I've also uninstalled and reinstalled matplotlib using pip.
I believe my problem is the module paths that python uses to search for imported modules are different between the two.
When I use the 'print(sys.path)' command in the python shell and the command line I get two different outputs.
Any help would be greatly appreciated!!!
The file different system paths between the python shell and the command line
You have two versions of python. I would recommend you to remove all pythons you have and go for anaconda https://www.anaconda.com/distribution/. It will fix your path problems and allow you to create environments with different versions of python. This is the least painful way also for future :) good luck.
I suppose, you have both of the Python versions installed on the same computer.
If that is so, then my answer would be to go inside both Python script folders and install matplotlib on both of them.
I have also faced that issue. My path includes pip of Python 3.7.1 and whenevwer I try to import modules on Python 3.4. It throws an error!
Maybe, you could add both of the Pythons to the path.
I encountered this same problem – python -c "import sklearn" would work just fine, but import sklearn inside a Python program failed. Both my one-liner and program was using the same Python version (version 3.8.10).
I eventually got the program to work by replacing the shebang line (originally #!/usr/bin/python) with #!/bin/env python.
I don't know why this worked exactly (sorry). Presumably some path got reset, and the module loaded from a different location, but it might help someone so I'm posting it here nontheless. (If you know more, feel free to edit this answer.)
I am trying to use pygubu designer to make some interfaces. I am using Anaconda and my Python version is 3.7.6. The pygubu-designer.exe file is in the Scripts directory (C:\Users\user\Anaconda3\Scripts) but when I want to execute the application, an error code shows up saying the file is not found. Do you have any idea of what is causing this error ?
I installed pygubu via pip before... Thanks
With a little thinking I re intalled the pygubu module, and now it's working fine... Sorry for the inconvenience. Have a good day !
Hello everyone,
So I have been trying to use Jython to connect to an API Rest and retrieve some information. Now I want to use the Flask Framework with it. I have been trying to install the Flask with Jython but it does not seem to work at all. I am working on a Windows 7 machine and the problem for me is also that I can not download directly from the internet. For all other framework I used python wheels and installed these with Jython which worked fine.
I already tried to following commands and got these errors:
First error that I got was that it could not find the 'init.py' file in the flask folder so I changed the path in the file to the total path. But it just continued to give me more errors.
jython -m pip install '*.whl
Screenshot of the command line ouput of the error
pip install '*.whl (same as above)
I am a little stuck here and I hope that someone has an idea on how to solve this problem.
Big thanks already!!
This appears to be a bug with Jython 2.7.0. See this error report in pip and this one in Jython.
The second of those indicates that it is fixed in the 2.7.1 release candidate.
I want to use matplotlib from my Sublime Text 2 directly via the build command.
Does anybody know how I accomplish that? I'm really confused about the whole multiple python installations/environments. Google didn't help.
My python is installed via homebrew and in my terminal (which uses brew python), I have no problem importing matplotlib from there. But Sublime Text shows me an import Error (No module named matplotlib.pyplot).
I have installed Matplotlib via EPD free. The main matplotlib .dmg installer refused to install it on my disk, because no system version 2.7 was found. I have given up to understand the whole thing. I just want it to work.
And, I have to say, for every bit of joy python brings with it, the whole thing with installations and versions and path, environments is a real hassle.
Beneath a help for this specific problem I would appreciate any helpful link to understand and this environment mess.
I had the same problem and the following fix worked for me:
1 - Open Sublime Text 2 -> Preferences -> Browse Packages
2 - Go to the Python folder, select file Python.sublime-build
3 - Replace the existing cmd line for this one:
"cmd": ["/Library/Frameworks/Python.framework/Versions/Current/bin/python", "$file"],
Then click CMD+B and your script with matplotlib stuff will work.
Well, this tutorial on how to install matplotlib in brew world helped me:
http://penandpants.com/2012/02/24/install-python/
While experienced problems installing scipy on Mountain Lion, this helped furthermore:
Scipy Installing to Wrong Place on Mountain Lion?