--- a/test/test.py
+++ b/test/test.py
@@ -1237,6 +1237,9 @@
 class TestBashGlobal(TestBash):
     install_cmd = 'eval "$(activate-global-python-argcomplete --dest=-)"'
 
+    def tearDown(self):
+        self.sh.run_command('rm -f ~/.pydistutils.cfg')
+
     def test_python_completion(self):
         self.sh.run_command('cd ' + TEST_DIR)
         self.assertEqual(self.sh.run_command('python3 ./prog basic f\t'), 'foo\r\n')
@@ -1272,6 +1275,7 @@
             self.sh.run_command('cd ' + os.getcwd())
             self.sh.run_command('export PATH=$PATH:./bin')
             self.sh.run_command('export PYTHONPATH=.:$PYTHONPATH')
+            self.sh.run_command('echo -e "[install]\nprefix=" > ~/.pydistutils.cfg')
             test_package = os.path.join(TEST_DIR, 'test_package')
             command = 'pip3 install {} --target .'.format(test_package)
             if not wheel:
