dotenv 安装错误:“错误:无效命令‘dist_info’”

Max*_*Max 7 python pip dotenv

我在 macOS 上安装 dotenv 时遇到错误:

\n
Collecting dotenv\n  Using cached dotenv-0.0.5.tar.gz (2.4 kB)\n  Installing build dependencies ... done\n  Getting requirements to build wheel ... done\n  Installing backend dependencies ... error\n  error: subprocess-exited-with-error\n  \n  \xc3\x97 pip subprocess to install backend dependencies did not run successfully.\n  \xe2\x94\x82 exit code: 1\n  \xe2\x95\xb0\xe2\x94\x80> [29 lines of output]\n      Collecting distribute\n        Using cached distribute-0.7.3.zip (145 kB)\n        Installing build dependencies: started\n        Installing build dependencies: finished with status 'done'\n        Getting requirements to build wheel: started\n        Getting requirements to build wheel: finished with status 'done'\n        Preparing metadata (pyproject.toml): started\n        Preparing metadata (pyproject.toml): finished with status 'error'\n        error: subprocess-exited-with-error\n      \n        \xc3\x97 Preparing metadata (pyproject.toml) did not run successfully.\n        \xe2\x94\x82 exit code: 1\n        \xe2\x95\xb0\xe2\x94\x80> [6 lines of output]\n            usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]\n               or: setup.py --help [cmd1 cmd2 ...]\n               or: setup.py --help-commands\n               or: setup.py cmd --help\n      \n            error: invalid command 'dist_info'\n            [end of output]\n      \n        note: This error originates from a subprocess, and is likely not a problem with pip.\n      error: metadata-generation-failed\n      \n      \xc3\x97 Encountered error while generating package metadata.\n      \xe2\x95\xb0\xe2\x94\x80> See above for output.\n      \n      note: This is an issue with the package mentioned above, not pip.\n      hint: See above for details.\n      [end of output]\n  \n  note: This error originates from a subprocess, and is likely not a problem with pip.\nerror: subprocess-exited-with-error\n\n\xc3\x97 pip subprocess to install backend dependencies did not run successfully.\n\xe2\x94\x82 exit code: 1\n\xe2\x95\xb0\xe2\x94\x80> See above for output.\n\nnote: This error originates from a subprocess, and is likely not a problem with pip.\n
Run Code Online (Sandbox Code Playgroud)\n

有人在另一个帖子中说它需要QT5。我尝试安装 QT5 但仍然遇到错误。

\n

小智 17

我在 Windows 上遇到了这个问题。另一个答案对我不起作用。

然而,运行这个确实:

pip install python-dotenv 
Run Code Online (Sandbox Code Playgroud)

或者,如果您有pip3Python 3:

pip3 install python-dotenv
Run Code Online (Sandbox Code Playgroud)


小智 0

我认为问题与distribute包有关,而不是与dotenv. 更新pip并单独setuptools安装distribute,然后尝试dotenv再次安装。

更新pipsetuptools

python -m pip install --upgrade pip setuptools
Run Code Online (Sandbox Code Playgroud)

distribute单独安装:

pip install distribute
Run Code Online (Sandbox Code Playgroud)

重试安装dotenv

pip install dotenv
Run Code Online (Sandbox Code Playgroud)