Having trouble with setup.py

徘徊边缘 提交于 2019-12-06 16:35:56
sudo apt-get install python-setuptools

OR

sudo aptitude install python-setuptools

Then just run:

sudo easy_install <module>

e.g.

sudo easy_install BeautifulSoup

sudo aptitude install python-beautifulsoup should do that for you. Synaptic is alright, but I prefer aptitude for many reasons (CLI is one of them obviously). Most of the modules you want should be available through your package manager, and beautifulsoup should definitely be. If that command does not work for you, there are other issues you need to look at.

You should definitely be able to use easy_install for more popular packages and well, and as far as utilizing setup.py you need to be in a directory actually containing it. What does ls | grep setup.py return for you when you are in the proper working directory? setup.py typically comes with a downloaded package, so make sure you are actually in the folder containing that package.

See other answers that recommend using the package manager that comes with Ubuntu (aptitude). This is the easiest way to do it.

However, to answer your specific question, to install a package based on the Distutils you need to download the package, extract it, and then run the setup.py script.

As an example for BeautifulSoup:

Download the package from Beautiful Soup 4.1.3 (at time of writing get the beautifulsoup4-4.1.3.tar.gz tarball).

wget http://www.crummy.com/software/BeautifulSoup/bs4/download/beautifulsoup4-4.1.3.tar.gz
tar xvfz beautifulsoup4-4.1.3.tar.gz
cd beautifulsoup4-4.1.3
sudo python setup.py install

Sudo command will not work in Windows.

If you have something to install don't use Sudo, instead directly install your file:

for ex: If you sudo python3 setup.py install

then windows users can just type setup.py install

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!