公司电脑无root权限下Python依赖安装及pip3配置重置问题
First, let's break down the root issue: your pip configuration was pre-set to use your company's private JFrog PyPI repository, which triggers an authentication prompt that's failing your dependency installs and virtualenv setup. Your error log makes this clear:
Looking in indexes: https://pypi.org/simple, https://firstname.lastname:jFrog12345@companydev.jfrog.io/companydev/api/pypi/pypi/simple
Here's a straightforward, step-by-step solution to reset pip and get your ML dependencies installed locally without touching system directories:
1. Check Current Pip Configuration
First, confirm the problematic repo settings exist:
pip3 config list
You’ll likely see entries like global.index-url or global.extra-index-url pointing to the company JFrog address.
2. Reset Pip to Default Settings
We’ll clear the user-level pip config (since you don’t have root access to modify system-wide settings):
- Delete the user pip config file directly:
Note: If this file doesn’t exist, checkrm ~/.config/pip/pip.conf~/.pip/pip.confinstead—location can vary slightly. - Alternatively, unset the problematic config entries one by one:
pip3 config unset global.index-url pip3 config unset global.extra-index-url
3. Verify the Reset
Run pip3 config list again. You should see no repo-related entries, meaning pip will now default to the official PyPI.
4. Install Dependencies Locally with --user
Now you can install numpy, gym, and other packages directly to your user-specific site-packages directory—no system permissions needed:
pip3 install --user numpy gym
These will land in ~/.local/lib/python3.6/site-packages (matching your Python 3.6 setup), which is entirely safe and isolated from system files.
5. Fix Virtualenv Setup (If You Still Want It)
If you prefer using a virtual environment to isolate your ML project, follow these steps:
- First upgrade your local virtualenv to avoid the built-in download that triggers the JFrog prompt:
pip3 install --user --upgrade virtualenv - Create the virtual environment with the
--no-downloadflag (this uses your local copies of setuptools/pip/wheel instead of trying to fetch them from the company repo):python3 -m virtualenv --no-download env - Activate the environment:
source env/bin/activate - Install dependencies inside the virtual environment—pip here will use the default PyPI, no authentication required:
pip install numpy gym
This should resolve all authentication errors and let you work on your ML code without system directory modifications or dealing with the company repo.
内容的提问来源于stack exchange,提问作者Leviathan

