Quiero ejecutar la herramienta de la tercera parte escrita en python en mi máquina ubuntu ( herramienta corgy ).
Sin embargo, no sé cómo agregar módulos adicionales a la ruta de Python.
cat doc/download.rst There is currently no setup.py, so you need to manually add the download directory to your PYTHON_PATH environment variable.
¿Cómo puedo agregar directorio a PYTHON_PATH?
Yo he tratado:
export PYTHON_PATH=/home/user/directory:$PYTHON_PATH && source .bashrc
export PATH=/home/user/directory:$PATH && source .bashrc
python
import sys
sys.path.append("/home/user/directory/")
Pero cuando bash ejecutar esta herramienta obtengo:
Traceback (most recent call last): File "examples/dotbracket_to_bulge_graph.py", line 4, in import corgy.graph.bulge_graph as cgb ImportError: No module named corgy.graph.bulge_graph
Crea un .bash_profile
en tu directorio de inicio. Luego, agregue la línea
PYTHONPATH=$PYTHONPATH:new_dir EXPORT $PYTHONPATH
O mejor:
if [ -d "new_dir" ] ; then PYTHONPATH="$PYTHONPATH:new_dir" fi EXPORT $PYTHONPATH
Las propiedades de .bash_profile
se cargan cada vez que inicia sesión.
El comando de source
es útil si no desea iniciar sesión nuevamente.