سؤال

Docutils is a great package. If you are using Django the admindocs package needs docutils. Instructions are available for installing with a web browser, but what if you are remote and logging in with a terminal over SSH? How to install in that case? What if you just want a quick recipe to do the job with the terminal?

هل كانت مفيدة؟

المحلول

I know I'm rather late to this question, but the accepted answer doesn't really reflect the common best practices from Python community members (and even less so from the Django community members.) While the outlined manual installation process does work, is is far more pains taking and error prone than the following:

You really should be using Pip. With Pip installing docutils system wide is as simple as:

$ sudo pip install docutils

This not only works for docutils but nearly any package on the 'Cheese Shop' as well as many other code repositories (Github, Bitbucket, etc.)

You may also want to look into other common Python best practice tools like virtualenv and virtualenvwrapper so that you can avoid global package installation.

To install Pip on Ubuntu/Debain I generally do the following:

$ sudo apt-get install python-pip

BTW: for virtualenv 'sudo apt-get install python-virtualenv' and for virtualenvwrapper 'sudo apt-get install virtualenvwrapper'.

نصائح أخرى

The key to the install is to use the curl utility. The following will install docutils:

mkdir docutilsetup
cd docutilsetup
curl -o docutils-docutils.tar.gz http://docutils.svn.sourceforge.net/viewvc/docutils/trunk/docutils/?view=tar
gunzip docutils-docutils.tar.gz 
tar -xf docutils-docutils.tar 
cd docutils
sudo python setup.py install

This performs the following steps: Create a directory to download docutils into. cd into the directory just made, and use curl to download the zipped version of docutils. Unzip the file which creates a subdirectory docutils. cd into that directory and install with root permissions.

If you are using Django you will have to restart Django for admindocs to start working.

Although it is an old thread, I want to share the answer I found. To install type command

sudo apt install python-docutils

or

sudo apt install python3-docutils

This will install the dependencies too. Yesterday, I installed docutils using this command for Geany editor and it is working fine.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top