diff --git a/lib/datasource/pypi.js b/lib/datasource/pypi.js
index 8c1a3bab9093c4b720f7db7df1f000624792a036..24c30ef10ed0ed71b3fe85753d7ad1781fefff3d 100644
--- a/lib/datasource/pypi.js
+++ b/lib/datasource/pypi.js
@@ -17,6 +17,9 @@ async function getDependency(purl, config = {}) {
   if (!is.empty(config.registryUrls)) {
     [hostUrl] = config.registryUrls;
   }
+  if (process.env.PIP_INDEX_URL) {
+    [hostUrl] = [process.env.PIP_INDEX_URL];
+  }
   const lookupUrl = url.resolve(hostUrl, `${depName}/json`);
   try {
     const dependency = {};
diff --git a/test/datasource/__snapshots__/pypi.spec.js.snap b/test/datasource/__snapshots__/pypi.spec.js.snap
index 1ef2c124950fa47565a7c24811f07a37398d4946..f627631db7c7aa5c2f7a02f321c05c94ea5af829 100644
--- a/test/datasource/__snapshots__/pypi.spec.js.snap
+++ b/test/datasource/__snapshots__/pypi.spec.js.snap
@@ -113,3 +113,14 @@ Array [
   ],
 ]
 `;
+
+exports[`datasource/pypi getDependency supports custom datasource url from environmental variable 1`] = `
+Array [
+  Array [
+    "https://my.pypi.python/pypi/azure-cli-monitor/json",
+    Object {
+      "json": true,
+    },
+  ],
+]
+`;
diff --git a/test/datasource/pypi.spec.js b/test/datasource/pypi.spec.js
index d61a953c0e557ceda3cf247061407f4dc541a8d5..fc879ddadde89766aab44a0e88bf0ce66cac0dae 100644
--- a/test/datasource/pypi.spec.js
+++ b/test/datasource/pypi.spec.js
@@ -39,6 +39,16 @@ describe('datasource/pypi', () => {
       await datasource.getDependency('pkg:pypi/azure-cli-monitor', config);
       expect(got.mock.calls).toMatchSnapshot();
     });
+    it('supports custom datasource url from environmental variable', async () => {
+      got.mockReturnValueOnce({
+        body: JSON.parse(res1),
+      });
+      const pipIndexUrl = process.env.PIP_INDEX_URL;
+      process.env.PIP_INDEX_URL = 'https://my.pypi.python/pypi/';
+      await datasource.getDependency('pkg:pypi/azure-cli-monitor');
+      expect(got.mock.calls).toMatchSnapshot();
+      process.env.PIP_INDEX_URL = pipIndexUrl;
+    });
     it('returns non-github home_page', async () => {
       got.mockReturnValueOnce({
         body: {