pip.conf 文件的位置 [英] location of pip.conf file

查看:47
本文介绍了pip.conf 文件的位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个必须同时在 Windows 和 Linux 上运行的系统.它使用 Python 的 venv 模块来处理与 Python 相关的所有事情.我需要创建一个 pip.conf 文件来激活我个人 ~/.pip/pip.conf 的拾取,将它指向我们的内部 PyPi 服务器而不是全局一.对于其他场景,我还需要能够将值直接硬编码到 venvpip.conf 中.我不知道文件应该放在哪里.

I am working on a system that has to work on both Windows and Linux. Its uses Python's venv module for everything related to Python. I need to create a pip.conf file to activate the pickup of my personal ~/.pip/pip.conf to point it to our internal PyPi server instead of the global one. I also need to be able to hard code the values right into the venv's pip.conf for other scenarios. I can't figure out where the file should be placed.

简而言之,有时我需要它来使用我个人的pip.conf,有时我需要它来使用venvpip.conf,在 Linux 和 Windows 上(我的机器是 Windows).

In short, sometimes I need it to use my personal pip.conf, sometimes I need it to use the venv's pip.conf, on both Linux and Windows (my machine is Windows).

我的venv创建后的文件夹结构是这样的:

The folder structure of my venv after creation is this:

myproject/build/venv/Include
                    /Lib
                    /Scripts

pip.conf 去哪里了?我一直在阅读文档 %virtual_env%/pip.conf 但是当你不知道 virtual_env 的价值时,它是一个非常无用的声明.

Where does the pip.conf go? I keep reading in the documentation %virtual_env%/pip.conf but when you don't know what the value of virtual_env, its a pretty useless statement.

我的猜测是 myproject/build/venv/pip.conf,对吗?

编辑**

好吧,我错了.将它放在 venv 文件夹的根目录中不起作用.我会继续尝试,问题是每次代码更改需要一个小时后重新部署这个应用程序.

Well, I was wrong. Putting it in the root of the venv folder didn't work. I'm going to keep trying, problem is to redeploy this app after each code change takes an hour.

推荐答案

定位文件夹的最简单方法是在 cmd 中运行以下命令.

The easiest way to locate the folder is by running the following command in the cmd.

pip config -v list

这将导致 pip 正在搜索以查找配置文件的路径.globalusersite 有不同的路径.您甚至可以根据自己的特定需求添加一个.

That will result with the paths that pip is searching in to find the config file. There are different paths for global, user, site. And you can even add one for you specific needs.

这篇关于pip.conf 文件的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆