How to install third-party modules on python3 - python

There are several versions of python on my mac OS X system.
I just installed beautiful soup4 on python2.7.6, but how can I install the same module on the version 3.4.3?

From the BeautifulSoup Official Documentation:
Beautiful Soup 4 is published through PyPi, so if you can’t install it
with the system packager, you can install it with easy_install or pip.
The package name is beautifulsoup4, and the same package works on
Python 2 and Python 3.
$ easy_install beautifulsoup4
$ pip install beautifulsoup4

You should always use a virtualenv. For each project, install the requirements you need inside that project's own virtualenv.

Related

beautiful soup not getting downloaded

When I try downloading BeautifulSoup, it is not downloading in a compressed folder and i'm not sure of the format it is in. I have tried downloading all the versions, but thy all result in the same thing.
The picture is attached below.
You Can Download ( beautifulsoup4 4.6.0 ) It From Below Link Directly Download Package.
https://pypi.python.org/pypi/beautifulsoup4
Or
For Command Line .. Follow THis Steps
http://www.pythonforbeginners.com/beautifulsoup/beautifulsoup-4-python
Steps:
If you run Debian or Ubuntu, you can install Beautiful Soup with the
system package manager
apt-get install python-bs4
Beautiful Soup 4 is published through PyPi, so if you can’t install it
with the system packager, you can install it with easy_install or pip.
The package name is beautifulsoup4, and the same package works on
Python 2 and Python 3.
easy_install beautifulsoup4
pip install beautifulsoup4
If you don’t have easy_install or pip installed, you can download ( https://www.crummy.com/software/BeautifulSoup/bs4/download/4.0/ ) the Beautiful
Soup 4 source tarball and install it with setup.py.
python setup.py install

How to install beautifulsoup into python3, when default dir is python2.7?

I have both Python 2.7 and Python 3.5 installed. When I type pip install beautifulsoup4 it tells me that it is already installed in python2.7/site-package directory.
But how do I install it into the python3 dir?
I think pip3 will satisfy your needs, use the below command on the terminal:
pip3 install beautifulsoup4
See doc
Run as root:
apt-get install python3-bs4
#or
pip3 install beautifulsoup4
Afterwards import it like this:
import bs4
If you’re using a recent version of Debian or Ubuntu Linux, you can install Beautiful Soup with the system package manager:
$ apt-get install python-bs4 (for Python 2)
$ apt-get install python3-bs4 (for Python 3)
Afer install import the library
from bs4 import BeautifulSoup
The package is bs4 and can be installed with following command:
python -m pip install bs4
I had some mismatch between Python version and Beautifulsoup. I was installing this project
Th3Jock3R/LinuxGSM-Arma3-Mod-Update
to a linux centos8 dedicated Arma3 server. Python3 and Beautifulsoup4 seem to match.So I updated Python3, removed manually Beautifulsoup files and re-installed it with: sudo yum install python3-beautifulsoup4 (note the number 3). Works. Then pointing directories in Th3Jock3R:s script A3_SERVER_FOLDER = "" and A3_SERVER_DIR = "/home/arma3server{}".format(A3_SERVER_FOLDER) placing and running the script in same folder /home/arma3server with python3 update.py. In this folder is also located new folder called 'modlists' Now the lightness of mod loading blows my mind. -Bob-
If you are on windows, this works for Python3 as well
py -m pip install bs4

installation lxml package Python

I cant install lxml package for python scraping. I installed required lbraries C http://users.skynet.be/sbi/libxml-python/ . Tryed it with python 2.7 2.7 3.4 . dowsnt work still cant install my lxml package .
Use the required .whl file from any source Example and use pip.
pip install "location where .whl is saved"
Pip can be found in PYTHONHOME/Scripts. pip is available by default from 2.7.10

Installing Ghost.py

I have installed new system and time has come to install Python and modules I have lost..
I had no problems with BeautifulSoup but can't make Ghost.py into work!
Using Fedora 21 and Python-3.4.3.
I have tried pip install pyside and then pip install ghost but I guess it worked only for an old python 2.7. Also pip3 install.. respectively.
It would be awesome if any of you could help me install this module :)
You need to literally call the install for Ghost.py since the module isn't named ghost through PyPi.
Python2:
pip install Ghost.py
Python3:
python3.4 -m ensurepip
pip3.4 install Ghost.py
Note: You may need to use sudo to install pip.
Then you will be able to use Ghost:
from ghost import Ghost
ghost = Ghost()
Note: Do make sure that you have OpenSSL installed before any installation of Python where you intend to use Ghost.
See: Ghost.py.

ImportError: No module named lxml - Even though LXML Is installed

I'm getting this error "ImportError: No module named lxml" Even though LXML Is definitely installed. Specifically it's installed within the python Virtualenv for the project. and ultimately I'm working on the Python/Amazon Product API. I get the error after trying to run one of the example scripts for that project from the terminal (mac).
How can I fix this? or further track down the issue?
Google searching lead me to:
Reintsall LXML
Ensure Xcode license was agreed to: sudo xcodebuild -license
Updating LXML with: pip install --upgrade lxml Currently at ver 3.4.0
reinstalled LXML dependencies as outlined here - pip install libxml2-dev libxslt-dev python-dev
The line of code throwing the error is from lxml import etree, objectify, this is in a folder far away from where LXML is installed in my virtual environment (although I am running the script from within my virtualenv in terminal). If the issues is simply a matter of the script not knowing where to find the LXML install, how would I fix that?
It turns out that I found my answer here: import lxml fails on OSX after (seemingly) successful install
Apparently, LXML Install on a Mac ends up installing it in the wrong path, so you have to reset the path using: export PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}"
So it turns out that if you're using python via homebrew, things get a little sketchy with apps like Inkscape that have it hardcoded in their mind that a certain version of python is needed.
Getting the right python version was simply uninstalling brew & installing PIP:
brew uninstall --ignore-dependencies python
sudo easy_install pip
STATIC_DEPS=true sudo pip install lxml
if your python is python 3.6, try pip3.6 install lxml

Categories

Resources