gpt4 book ai didi

Python PIP 抛出错误 - ImportError : cannot import name main

转载 作者:行者123 更新时间:2023-12-01 01:13:21 25 4
gpt4 key购买 nike

我对 python/pip 非常陌生,此时我只是摆弄一些事情,尝试安装我的环境,以便我可以开始测试该语言。

我已经正确安装了 PIP,但试图找到一些可以帮助我将解释器集成到 Jetbrains PyCharm 中的东西。我找到了一个名为 PIPEnv ( https://pypi.org/project/pipenv/ ) 的东西并安装了它,但现在它似乎破坏了 PIP

example@my-computer:~/hooks$ pip install pipenv
Collecting pipenv
Downloading https://files.pythonhosted.org/packages/bb/15/b155a5c0d19ce41609f50bb70a37e0de092b453ec4bd2eac59e53a2c3227/pipenv-2018.11.26-py2-none-any.whl (5.2MB)
100% |████████████████████████████████| 5.2MB 310kB/s
Collecting enum34; python_version < "3" (from pipenv)
Downloading https://files.pythonhosted.org/packages/c5/db/e56e6b4bbac7c4a06de1c50de6fe1ef3810018ae11732a50f15f62c7d050/enum34-1.1.6-py2-none-any.whl
Collecting virtualenv (from pipenv)
Downloading https://files.pythonhosted.org/packages/7e/1b/6c00d57127608793e16e8b7f813e64d58a1938505c42fe190d1386ab41e1/virtualenv-16.4.0-py2.py3-none-any.whl (2.0MB)
100% |████████████████████████████████| 2.0MB 821kB/s
Collecting typing; python_version < "3.5" (from pipenv)
Downloading https://files.pythonhosted.org/packages/cc/3e/29f92b7aeda5b078c86d14f550bf85cff809042e3429ace7af6193c3bc9f/typing-3.6.6-py2-none-any.whl
Collecting certifi (from pipenv)
Downloading https://files.pythonhosted.org/packages/9f/e0/accfc1b56b57e9750eba272e24c4dddeac86852c2bebd1236674d7887e8a/certifi-2018.11.29-py2.py3-none-any.whl (154kB)
100% |████████████████████████████████| 163kB 8.6MB/s
Collecting virtualenv-clone>=0.2.5 (from pipenv)
Downloading https://files.pythonhosted.org/packages/e3/d9/d9c56deb483c4d3289a00b12046e41428be64e8236fa210111a1f57cc42d/virtualenv_clone-0.5.1-py2.py3-none-any.whl
Collecting pip>=9.0.1 (from pipenv)
Downloading https://files.pythonhosted.org/packages/d7/41/34dd96bd33958e52cb4da2f1bf0818e396514fd4f4725a79199564cd0c20/pip-19.0.2-py2.py3-none-any.whl (1.4MB)
100% |████████████████████████████████| 1.4MB 1.2MB/s
Collecting setuptools>=36.2.1 (from pipenv)
Downloading https://files.pythonhosted.org/packages/d1/6a/4b2fcefd2ea0868810e92d519dacac1ddc64a2e53ba9e3422c3b62b378a6/setuptools-40.8.0-py2.py3-none-any.whl (575kB)
100% |████████████████████████████████| 583kB 2.7MB/s
Installing collected packages: enum34, virtualenv, typing, certifi, virtualenv-clone, pip, setuptools, pipenv
Successfully installed certifi-2018.11.29 enum34-1.1.6 pip-19.0.2 pipenv-2018.11.26 setuptools-40.8.0 typing-3.6.6 virtualenv-16.4.0 virtualenv-clone-0.5.1
example@my-computer:~/hooks$ pip list
Traceback (most recent call last):
File "/usr/bin/pip", line 9, in <module>
from pip import main
ImportError: cannot import name main

任何帮助都会很棒。

最佳答案

您可以尝试卸载pip和pip env。

Then reinstall pip and then try to again install pipenv. If this time it does not work then you need to use pip and virtualenv instead of pip env.

卸载它们,这次安装 pip 和 virtualenv
您可以配置 pycharm 以使用 virtualenv。
无论如何,这些命令对我有用
用于卸载

python3 -m pip3 uninstall pip3



sudo -H pip3 install --upgrade pip
sudo -H pip3 install pipenv

现在尝试执行“pipenv”
如果仍然不起作用,请尝试升级您的 python3。
如果您仍在使用python2.7,则将pip3替换为pip

关于Python PIP 抛出错误 - ImportError : cannot import name main,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54613390/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com