Running Python Script with lynx command in Terminal - python

I just installed emacs and python on my Mac and I'm trying to learn how to run my Python Scripts through my terminal and I'm getting an error message
"sh: lynx: command not found". From what I have researched it sounds like i need to install lynx on my mac but I do not know how to get it installed so if that is the issue how do I install lynx on a macbook? I will include screenshots of the issues I'm having. Thanks very much!
python scriptTerminal

You should already have Python on your mac. My Macbook Air came with python 2.x on El Capitan OSX. When you open up the Terminal and type in "python" without any quotations does the python interpreter come up? From the look of your image, there is something wrong inside the file you are trying to run with python.
As far as I know, Lynx is a Web Browser, are you trying to do something with Lynx inside that python file? If you happen to have brew on your mac you can try brew install lynx to install lynx onto the mac.
From the script, I think you are trying to get the source code from the link you are trying to open with lynx. Try this method instead if that is what you are doing.
Code:
from urllib.request import urlopen
html = urlopen("http://www.careercast.com/jobs-rated/2016-ranking-200-jobs")
with open("lang.txt",'w') as output:
output.write(html.read())
You can use pip to install urllib.request. If you do not have pip, it is very helpful when installing python packages, or you can use easy_install. Run this in the terminal if you already have pip installed. Otherwise follow this to install it.
pip install urllib.request

You might see the above error if Lynx package is not installed on your server. Follow the below steps to install lynx on your Linux Server
Login to your Linux Server via SSH as root. Run yum install lynx to install lynx package

Related

How do I install selenium without pip?

I need to install a package, Selenium, for python, but when I run ’pip install selenium’ in my command prompt, it says that ’ pip is not recognized as an internal or external command,
operable program or batch file’. I have added my pip path to PATH variables, and I have made sure that pip is installed properly. I have reinstalled python to make sure that pip is installed, and repaired python in case there were missing components or something. I have tried running ’py -m pip install selenium’, and it says that selenium is already installed, but when I run my code it says that there is no module named selenium. I have two different python programs, this python and Anaconda;Spyder. When I install selenium on Spyder, it works, but when I run the code it doesn’t work, not showing any errors. Can you help me
Do you maybe have multiple python versions on your system like for example python2.7 and python3.8?
Maybe you could try using
pip3 install ...
python3 -m install ...
python -m pip install ...
That worked for me. Could you also share your error.
Are you using macOS?
I ran into a similar issue a while back, try:
pip3 install selenium

Python package: pywin32_postinstall returns error

I'm trying to run python script as a windows service and then I need to use pywin32.
After installation pywin32 via pip install I should run pywin32_postinstall as python pywin32_postinstall -install. I've got this reply and have no idea about this situation anymore:
'scripts/pywin32_postinstall.py' not found in metadata at c:\python\lib\site-packages\
As a result I can't run my service.
Did You meet similar situation or have You any ideas?
I solved my problem!
Don't install via pip
Just need to download suitable file from here: https://github.com/mhammond/pywin32/releases
After the installation run python pywin32_postinstall -install and no errors will not occur.
try running "python scripts\pywin32_postinstall.py -install" from the root of the install directory

Installing txMYSQL on Python

I am trying to establish MYSQL connection with my twisted server script. I found out that txMYSQL is a good choice to use, I dowloaded the package out of Github and tried installing from the setup.py file, but it didn't work.
I tried inslalling txMYSQL by using easy_install txmysql but it dosen't appear to be found through this command since its not on pythons server.
How can I install txMYSQL ?
I am currently using python 2.7.8 on my Windows machine.
Try to install using pip and referencing Github repo. I tried here and worked well on a Ubuntu 12.04.4
pip install git+https://github.com/hybridlogic/txMySQL.git

Python xmpp module compatible with osx

Hi I'm trying to run GCM sample fromhttp://developer.android.com/google/gcm/ccs.html on osx but i'm unable to install xmpp library. On Linux installation apt-get install python-xmpp resolved case. For osx I couldn't find anything
There is another repository called ActiveState PyPM
Try to download it from here:
http://www.activestate.com/activepython/downloads
install it, and after, write on a cmd line:
pypm install xmpppy
That worked for me

Python - ImportError: No module named 'requests'

I get this error when running code, so it appears that requests hasn't installed properly. I am running Windows 7 32-bit system with Python 3.3.
When I go into 'Programs and Features' in windows it shows up as installed.
I installed this program from http://www.lfd.uci.edu/~gohlke/pythonlibs/ and I have also downloaded the requests folder and tried installing it this way, I can't seem to get this to work.
I have visited ImportError: No module named 'requests' already, but I didn't find this helped at all.
I keep seeing the following statement, but I am uncertain of how to run this?
$ python setup.py install
Please help!?!
The answer there is clear. But let me explain to you as good as I can. This error comes because requests module is not installed in your system
Download the requests module to your system from here
And extract it. Go to your command prompt/terminal and reach to the folder you downloaded.There, you will see setup.py, the file that you need to execute to install the requests module.
python setup.py install
Installs the requests module
This line:
$ python setup.py install
It's a command line in a terminal in Linux or the alike. My guess is that you could do the same opening a terminal in Windows pressing the start key and typing 'cmd', without quotes of course. If you had python already install the %PATH% variable should be set up properly and it should just run. Well, perhaps you need to go to the same folder as the setup.py using
> cd path_to_file
And then,
> python setup.py install
I hope it helps. Let me know otherwise.
If you are using Ubuntu, there is need to install requests
run this command:
pip install requests
if you face permission denied error, use sudo before command:
sudo pip install requests

Categories

Resources