Reputation: 235
I've been using python for a while but I can't remember how I used to install modules, I haven't needed to in forever. I recently reinstalled ubuntu so now I need to.
Firstly, I try to run setup.py and get this:
nicholas@nicholas-K53E:~$ python setup.py install
python: can't open file 'setup.py': [Errno 2] No such file or directory
I tried using synaptic to install BeautifulSoup but it didn't work either and python tells me there's no modules named that.
Some forums said that it had to do with being in the wrong working directory so I cd'd into my Python26 folder and tried to run python ./setup.py install from there and it still didn't work. I'm not sure what the deal is.
Any guidance?
Upvotes: 3
Views: 49083
Reputation:
Are you using windows? if so, replace the python
with C:\python39\python.exe
and type in the rest of the command.
Upvotes: 0
Reputation: 1
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
Upvotes: 0
Reputation: 87054
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
Upvotes: 1
Reputation: 6571
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
Upvotes: 4
Reputation: 1574
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.
Upvotes: 1