Python can't install modules (3.2.5) - python

I'm quite a newbie to python, and I was trying to install mechanize for python 3.2.5
I looked up where to find it and found this page: https://github.com/adevore/mechanize/tree/python3 which I assume would work with python 3.2.5
However, it says in the install.txt to run "python setup.py install" but does not tell me where to run that code. I tried cmd but it told me: "python is not recognized as an internal or external command, operable program or batch file"
So, instead, I tried the other option it gave me, which was to drag the contents of the mechanize zip file to the site packages folder. That didn't work either.
If anyone could help me install this module, that would be greatly appreciated. Also, I'm using Windows10 64 bit with Python 3.2.5

If you are getting the error
"python is not recognized as an internal or external command, operable program or batch file"
And you have installed python, then the issue is likely to be that the directory where you have installed python is not in your PATH.
(more often than not, python is installed in a folder pythonXX in your C:// Drive)
Get python onto your path
In cmd prompt type in %PATH%. And confirm that the directory is not there.
To place directories into the path run this commands in command prompt, replacing pythonXX with the directory where you have python installed.
set PATH=%PATH%;C:\pythonXX
To make this change more permanent, i suggest you read this article by How-To-Geek.
After you've placed the python directory into your path, test that python does indeed now run from cmd prompt by typing python into cmd prompt and you should see something like this
Python 3.2.25 (default, Oct 19 2015, 18:04:42)
>>>
go nuts :D
Time to install mechanize tree
now get back out of the python interpreter (type in exit or ctrl-d) and make your way towards the directory where mechanize tree is based (use the cd command to move directories and the dir command to list the contents of directories)
Once in there run the command
python setup.py install
and it should work like a charm :)

Related

SCons does not seem to install (Windows)

I have been trying for hours to install SCons on my Windows 8.1 machine and simply cannot. I honestly have no idea whatsoever what I'm doing wrong, or really what I'm doing in general. Here is the step by step process of what I have done
1: installed Python 3.7 from www.python.org I used the python-3.7.3-amd64.exe to install it, it seems to have worked (I have never used python before so if anything is off I wouldn't realize it). When I use the command console and input 'python --version' it outputs 'Python 3.7.3'
2: I downloaded scons-3.0.5.zip from www.scons.org I followed the website's instructions as best I could. I used 7zip to extract it's contents into a new file called 'scons-3.0.5' located at C:\ It's complete path, therefore, is C:\scons-3.0.5
3: I ran Python 3.7 as an admin. I inputted '# cd scons-3.0.5' just as the scons website says to do. It outputted nothing, and I noticed that the new line started with '...' instead of '>>>', I have no previous experience with Python so I don't know if that's good or bad. I then continued to follow the instructions by inputting '# python setup.py install', it outputted nothing, and once more the new line started with '...'. I hoped that was all I needed to do but in the command console I inputted 'scons --version' (I read somewhere this can be done to check if it is installed), it outputs "'scons' is not recognized as an internal or external command, operable program, or batch file.". This, combined with the fact that seemingly nothing is different, leads me to believe it has not been installed.
4: I tried to do something a bit different. I noticed that the zipped file I downloaded from the scons website contained 2 files in it, 1 being scons-3.0.5, the other being pywin32-master.zip, I had both of these in the file C:\scons-3.0.5 I decided to delete that file, and in its same location place the scons-3.0.5 file. Now instead of C:\scons-3.0.5 including scons-3.0.5 and pywin32-master.zip it contained just the contents of the scons-3.0.5 file that was in it before (if that makes sense, I might clean it up in the morning and make it easier to read). I once more did step 3, and the results were no different.
I have no idea what I'm doing, I have no prior experience with Python or the command console, I just want to set up scons and never use Python again. Does anyone know how I can fix this? I have googled for hours but it seems as if I'm the only one who's having this issue.
The contents of the zipped file from scons website:
contents of the scons-3.0.5 file in the zipped file
I doubt the images will help but I have included them just in case if they seem off
edit: I did know what installing via Pip was, but I googled it and it worked just fine! Thanks to Alexander Lopatin and bdbaddog for the help
So you're mistake is in step 3.
I ran Python 3.7 as an admin. I inputted '# cd scons-3.0.5'
The website says:
# cd scons-3.0.5
# python setup.py install
Notice this is
cd into the unzipped directory
THEN run python setup.py install
Instead you've run python, then typed a shell command into python. Which is why you had issues.
Note: On windows you shouldn't need to run as admin to install SCons.
Although as #dirkbaechle said. Pip is the preferred method to install python.
python -mpip install scons
But if you'd rather follow the instructions. Just bring up a windows command shell, or powershell if you like, cd into the unzipped directory, and run python setup.py install
BTW. There's an IRC channel and a users mailing list for SCons support.
https://scons.org/contact.html

Python Fullstack Application - python manage.py runserver - No such file or directory

I have followed this tutorial on Youtube.
First, I think everything was fine etc. but when I want so run the Server with: python manage.py runserver it doesn't work. I got the following error:
bash: /Applications/MAMP/Library/bin/python: No such file or directory
The manage.py file is there and I have tried it several times. I don't know what the problem can be. I have reinstalled python, home-brew, pip and virtualenv
It sounds like you don't have Python installed, or it isn't present in your PATH variables.
In command line try the following
python --version
You should expect to see
python x.x.x
If it isn't included in your PATH variables, you will receive
'python' is not recognized as an internal or external command,
operable program or batch file.
This can be fixed by going to the following
Right click This PC and select Advanced Properties
Click Environment Variables and select Path from the System variables
Click Edit and add Python. It should be at C:\PythonXX, though it would depend on your install directory
And adding Python
If Python is already installed
If Python is already installed, you aren't in the correct working directory. Could you please share your directory tree, including where manage.py is located.

"python" and "pip" command not found in Command Line [duplicate]

This question already has answers here:
How to add to the PYTHONPATH in Windows, so it finds my modules/packages?
(23 answers)
Closed 5 years ago.
I recently installed Python 3.6 for my Windows 10 (64bit) and I want to use pip, but before to install that, I need to execute the following command using the downloaded get-pip.py program:
python get-pip.py
Somehow this doesn't work and I get the following message from Command Line:
'python' is not recognized as an internal or external command,
operable program or batch file.
(I get the same message when I want to execute some pip commands)
I tried a lot of "solutions" for installing pip, like downloading files from https://bitbucket.org/pygame/pygame/downloads/ but nothing happened, I got the messages...
Could you explain to me why the Command Line doesn't know these commands and how can I install them?
No need for admin access:
The reason the error is arising is because python is not in your PATH (meaning it can be called from any directory in the prompt). You can check that its not in the PATH by typing the following:
echo %path%
which will return lost of different directory paths, but not the one to where you have python installed.
To add python to this (and get rid of your error), follow these steps:
Open up control panel.
Go to System. (skip to this step with: Win+Break )
Go to the Advanced tab at the top.
Click on Environment Variables at the bottom.
In the section User variables for ___, add a new one with New.
In this pop-up add the name : path and value : C:\Python34 (or wherever it is installed).
Hope this helps as this is what I did to get python to work from any directory in the command prompt!
Open your CMD as administrator and type PATH (prints the output of your system PATH Variable). There have to be a PATH directing to your Python Installation directory. Only with that system Path your cmd knows where python.exe is and search there for python.
Normally the Python Installation Setup asks if you want to set a Python Environment PATH Variable. Maybe run the setup again and watch out for that option. And I think there was a checkbox to automatic install pip for python.
If you want to set the Path Environment Variable use this:
https://superuser.com/questions/949560/how-do-i-set-system-environment-variables-in-windows-10
If you want to manually install pip with GET-PIP you have to download get-pip.py first and then run it with python.
Download get-pip from here.
https://pip.pypa.io/en/stable/installing/#installing-with-get-pip-py
Could you explain to me why the Command Line doesn't know these
commands and how can I install them?
This happens when Python executables are not added to PATH.
#xyres provided a nice link on how to do this.
I want to use pip, but before to install that, I need to execute the following command
using the downloaded get-pip.py program:
pip should be bundled with the official Python installer, so there should be no need to get it from other sources

How to import python module

I'm working on a project for which I need to a module. I want to know how to import some other module in python that is not installed.
When I write
import xaut
It gives error no module named xaut.
I have xaut-0.4.5 that I downloaded from following link.
Please help me how to use it.
Well I think following will help
Extract your zip file
Open the command line (a linux terminal or cmd on windows). I am on linux so I have a terminal.
Now enter the directory that you have extracted.
In it is a directory "python" cd into it.
If you run the ls command (if on windows run dir) you will see that in this directory there is a script "setup.py". We need to execute it for installation.
Execute this script by giving command python setup.py install
This will hopefully install it and then you would be able to import it.
Basically you have only downloaded the package. To make a package work you also need to install it. So when you download a package always search for a setup.py file.
This is certainly a duplicate question. You can look up how to add a python module to the path in windows.
here is an example
How to add to the pythonpath in windows 7?

Running a python script from the command line in Windows

I'm trying to run SnakeFood, to analyze a python project. I'm on a Windows machine and so far I've been able to figure out how to:
install Tortoise for Mercurial to download the SnakeFood code from the site
set the windows Path to accept python from the command prompt so I could do python setup.py install and got snakefood to go into my "site-packages" folder
Now, the documentation doesn't say anything else rather than:
sfood /path/to/my/project
I can't get this command to work. What am I missing?
Would this work?
python "DriveLetter:\path\to\sfood.py" "DriveLetter:\path\to\your\project"
Considering the documentation says "sfood /path/to/my/project" it most likely assumes a *nix environment. That leads me to the assumption that sfood probably has a shebang line.
On Windows you probably need to use "python sfood ". If "sfood" isn't in your PATH, you'll need to write the full path rather than just "sfood".
I was able to resolve this issue, on my Windows 7 machine with Python 2.7.3 installed, like so:
C:\> cd \path\to\snakefood\installation\folder
C:\path\to\snakefood\installation\folder> python setup.py install
...
C:\path\to\snakefood\installation\folder> cd C:\Python27\Scripts
C:\Python27\Scripts> python sfood \path\to\my\project
...

Categories

Resources