getting easy_install to install something for python2.5 when default is python2.7 - beautifulsoup

since i'm using google app engine, i have to use python2.5.
because of this, i need to install an older version of BeautifulSoup that works with python2.5 (i think bs 3.0.7a will work).
in order to do that, as far as i can tell, i need to get easy_install to put BeautifulSoup in the python2.5 folder rather than in the python2.7 folder, which is does by default.
the docu for easy_install said the following:
"Also, if you’re working with Python version 2.4 or higher, you can run Python with -m easy_install to run that particular Python version’s easy_install command."
but how exactly do i do that?

this guide helped me get it right:
http://achinghead.com/installing-multiple-versions-python.html

Related

When I open the nvim init.vim file, this error comes for Neoclide coc.vim

I get this error when I try to open the init.vim file for neovim, for neoclide coc.vim. Any solutions? in WSL(Ubuntu)
[coc.nvim] Error on execute :pyx command, ultisnips feature of coc-snippets requires pyx support on vim. use :CocOpenLog for details
Enter command pip install pynvim in your command line. It helped me. And before this you should have python on your PC.
you choose correct version of python in init.vim
let g:python3_host_prog="/usr/bin/version python"
example
let g:python3_host_prog="/usr/bin/python3.10"
I tried with installing pynvim and also have the latest pip (21.3.1). My vim version is 9.0 and compiled it from scratch.
But while searching the features included with vim, I realised that I had not included python. After following this answer, I enabled python while compiling vim. My issue has been resolved.
I had to upgrade pip first, then run pip install pynvim.
Most likely you default python install broke for some reason on you machine (was the same for me).
Try running the python command from the terminal.
If you get command not recognized than you know this is the problem.
Reinstalling python or
set the python the python path that vim uses to an installed python version that works
let g:python3_host_prog="/usr/bin/version python"
Assuming you have python3 installed.

How can I do pip install or same thing similar in terminal for Jython to install packages

I have just installed jython and want to install some packages like bs4 and mechanize in python I simply did pip install and done. How I can do the same thing for jython I tried jip install package_name but got an error. Please give the answer as simple as possible to follow thanks in advance.

Upload package to pypi moans "must use HTTPS"

When executing this from the command-line of within my package:
python setup.py sdist bdist_egg upload
I get:
Server response (403): Must access using HTTPS instead of HTTP
This used to work many times until now. Searching for the err-msg didn't give me helpful infos, has anyone a clue what's going on?
Update: Use twine for uploading distributions to pypi.
Are you using a .pypirc file?
If you are maybe change the urls to point to the https links?
[distutils]
index-servers =
pypi
pypitest
[pypi]
repository=https://pypi.python.org/pypi
username=your_username
password=your_password
[pypitest]
repository=https://testpypi.python.org/pypi
username=your_username
password=your_password
Updating setuptools let's the error dissapear:
pip install setuptools -U
Then running the upload-command ends with:
Submitting dist/my.packagename-1.3.tar.gz to https://upload.pypi.org/legacy/
error: None
But still, no new version is available at pypi.

Pillow installed but not identified (Mac OS Yosemite)

I Installed pillow using brew, and when I try to repeat the isntallation I see it's there:
brew install Homebrew/python/pillow
Warning: pillow-2.7.0 already installed
But when I try to load it into a script I get an error:
ImportError: No module named Image
Any suggestions?
python usually looks for Pillow under normal site package installs. Here's what I would do to get a minimal Pillow setup where python should be guaranteed to see it:
sudo easy_install pip
pip install Pillow
I think it may also be possible to just do:
sudo easy_install Pillow
but pip is a bit more user friendly if you're planning on using more python scripts that might have dependencies.
Note: another issue you might be running into is if you're trying to use the Homebrew python but are ending up using the base OSX install of it instead. Make sure which python is showing you what you expect it to be.

How to install modules for Python 2.7 on Ubuntu 10.10?

On Ubuntu 10.10, I am unable to install lxml to python 2.7. Here are the steps I take.
sudo su -
apt-get install python2.7
apt-get install python-lxml
Note when running the install for python-lxml package, the following appeared:
INFO: using unknown version '/usr/bin/python2.7' (debian_defaults not up-to-date?)"
Importing the module in python2.6 (the version that comes standard with Ubuntu) works. However, importing the module under python2.7 does not. So how does one install Python modules to a non-default Python installation?
Try to install libxml2, libxml2-dev, libxslt, libxslt-dev, python-dev. These are header files. Then try to install lxml again.
On Ubuntu 10.10 the python packages installed from the repositories get installed to /usr/lib/python2.6/dist-packages so one option is to add this path to your $PYTHONPATH environmental variable so python2.7 will look to the python2.6 directory for the libs.
What I've done on Ubuntu 10.10 is add
export PYTHONPATH="$PYTHONPATH:/usr/lib/python2.6/dist-packages"
to my .bashrc file, and also to my .gnomerc file. This sets the $PYTHONPATH for python instances started from the shell or from the gnome desktop. You should then be able to import the python libs which you have installed from the Ubuntu repositories in python2.7.
.bashrc and .gnomerc are both located in your home directory; you might have to create .gnomerc if it doesn't already exist. And one caution: I had a syntax error in my .gnomerc which stopped the gnome desktop from loading, and I couldn't log in. I had to use a recovery console to fix this syntax error and then I could log in again.
This seems a little hackish to me, so I'm interested in hearing better solutions.
Another solution might be to use the following code:
try:
from lxml import etree
except ImportError:
try:
# Python 2.5
import xml.etree.cElementTree as etree
except ImportError:
try:
# Python 2.5
import xml.etree.ElementTree as etree
except ImportError:
try:
# normal cElementTree install
import cElementTree as etree
except ImportError:
try:
# normal ElementTree install
import elementtree.ElementTree as etree
except ImportError:
print("Failed to import ElementTree from any known place")
[Source]
This will import lxml if it is available, or the original ElementTree otherwise.
I use this code for my application on Google App Engine (using Python 2.7): on the server it will use lxml, on my machine it will use ElementTree.
I have one easiest trick Just open synaptic package manager type "python-lxml" in search box it will show you all the dependencies and available packages select packages which you want to install and hit apply.