How to remove current directory from python import path

后端 未结 2 1890
盖世英雄少女心
盖世英雄少女心 2021-02-20 04:06

I want to work with the mercurial repository of hg itself. That is, I cloned Mercurial from https://www.mercurial-scm.org/repo/hg and want to run some hg

2条回答
  •  一整个雨季
    2021-02-20 04:41

    The way I would deal with the topic is by creating a /usr/local/bin/hg sh script with the following contents:

    #!/bin/sh
    PYTHONPATH=/usr/lib/pythonVERSION/site-packages /usr/bin/hg
    

    (Ubuntu-based distributives use dist-packages instead of site-packages)

    PYTHONPATH is a special environment variable respected by Python interpreter to get extra module import paths.

    Alternatively, you can export PYTHONPATH into your shell, but it will affect your whole experience.

提交回复
热议问题