问题:Python PIP安装会引发TypeError:-=:’Retry’和’int’不受支持的操作数类型

使用pip install了显然与Python2.7.11+我的Ubuntu 16.04系统中的任何模块抛出这个错误:

TypeError: unsupported operand type(s) for -=: 'Retry' and 'int'

点子有什么问题?如有必要,如何重新安装?

更新:下面是完整的追溯

sunny@sunny:~$ pip install requests
Collecting requests
Exception:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 209, in main
    status = self.run(options, args)
  File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 328, in run
    wb.build(autobuilding=True)
  File "/usr/lib/python2.7/dist-packages/pip/wheel.py", line 748, in build
    self.requirement_set.prepare_files(self.finder)
  File "/usr/lib/python2.7/dist-packages/pip/req/req_set.py", line 360, in prepare_files
    ignore_dependencies=self.ignore_dependencies))
  File "/usr/lib/python2.7/dist-packages/pip/req/req_set.py", line 512, in _prepare_file
    finder, self.upgrade, require_hashes)
  File "/usr/lib/python2.7/dist-packages/pip/req/req_install.py", line 273, in populate_link
    self.link = finder.find_requirement(self, upgrade)
  File "/usr/lib/python2.7/dist-packages/pip/index.py", line 442, in find_requirement
    all_candidates = self.find_all_candidates(req.name)
  File "/usr/lib/python2.7/dist-packages/pip/index.py", line 400, in find_all_candidates
    for page in self._get_pages(url_locations, project_name):
  File "/usr/lib/python2.7/dist-packages/pip/index.py", line 545, in _get_pages
    page = self._get_page(location)
  File "/usr/lib/python2.7/dist-packages/pip/index.py", line 648, in _get_page
    return HTMLPage.get_page(link, session=self.session)
  File "/usr/lib/python2.7/dist-packages/pip/index.py", line 757, in get_page
    "Cache-Control": "max-age=600",
  File "/usr/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/sessions.py", line 480, in get
    return self.request('GET', url, **kwargs)
  File "/usr/lib/python2.7/dist-packages/pip/download.py", line 378, in request
    return super(PipSession, self).request(method, url, *args, **kwargs)
  File "/usr/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/sessions.py", line 468, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/sessions.py", line 576, in send
    r = adapter.send(request, **kwargs)
  File "/usr/share/python-wheels/CacheControl-0.11.5-py2.py3-none-any.whl/cachecontrol/adapter.py", line 46, in send
    resp = super(CacheControlAdapter, self).send(request, **kw)
  File "/usr/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/adapters.py", line 376, in send
    timeout=timeout
  File "/usr/share/python-wheels/urllib3-1.13.1-py2.py3-none-any.whl/urllib3/connectionpool.py", line 610, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/usr/share/python-wheels/urllib3-1.13.1-py2.py3-none-any.whl/urllib3/util/retry.py", line 228, in increment
    total -= 1
TypeError: unsupported operand type(s) for -=: 'Retry' and 'int'

Using pip install for any module apparently on my Ubuntu 16.04 system with python 2.7.11+ throws this error:

TypeError: unsupported operand type(s) for -=: 'Retry' and 'int'

What is wrong with pip? How could I reinstall it, if necessary?

Update: Full traceback is below

sunny@sunny:~$ pip install requests
Collecting requests
Exception:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 209, in main
    status = self.run(options, args)
  File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 328, in run
    wb.build(autobuilding=True)
  File "/usr/lib/python2.7/dist-packages/pip/wheel.py", line 748, in build
    self.requirement_set.prepare_files(self.finder)
  File "/usr/lib/python2.7/dist-packages/pip/req/req_set.py", line 360, in prepare_files
    ignore_dependencies=self.ignore_dependencies))
  File "/usr/lib/python2.7/dist-packages/pip/req/req_set.py", line 512, in _prepare_file
    finder, self.upgrade, require_hashes)
  File "/usr/lib/python2.7/dist-packages/pip/req/req_install.py", line 273, in populate_link
    self.link = finder.find_requirement(self, upgrade)
  File "/usr/lib/python2.7/dist-packages/pip/index.py", line 442, in find_requirement
    all_candidates = self.find_all_candidates(req.name)
  File "/usr/lib/python2.7/dist-packages/pip/index.py", line 400, in find_all_candidates
    for page in self._get_pages(url_locations, project_name):
  File "/usr/lib/python2.7/dist-packages/pip/index.py", line 545, in _get_pages
    page = self._get_page(location)
  File "/usr/lib/python2.7/dist-packages/pip/index.py", line 648, in _get_page
    return HTMLPage.get_page(link, session=self.session)
  File "/usr/lib/python2.7/dist-packages/pip/index.py", line 757, in get_page
    "Cache-Control": "max-age=600",
  File "/usr/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/sessions.py", line 480, in get
    return self.request('GET', url, **kwargs)
  File "/usr/lib/python2.7/dist-packages/pip/download.py", line 378, in request
    return super(PipSession, self).request(method, url, *args, **kwargs)
  File "/usr/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/sessions.py", line 468, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/sessions.py", line 576, in send
    r = adapter.send(request, **kwargs)
  File "/usr/share/python-wheels/CacheControl-0.11.5-py2.py3-none-any.whl/cachecontrol/adapter.py", line 46, in send
    resp = super(CacheControlAdapter, self).send(request, **kw)
  File "/usr/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/adapters.py", line 376, in send
    timeout=timeout
  File "/usr/share/python-wheels/urllib3-1.13.1-py2.py3-none-any.whl/urllib3/connectionpool.py", line 610, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/usr/share/python-wheels/urllib3-1.13.1-py2.py3-none-any.whl/urllib3/util/retry.py", line 228, in increment
    total -= 1
TypeError: unsupported operand type(s) for -=: 'Retry' and 'int'

回答 0

Ubuntu附带了前寒武纪的PIP版本,如果您不想花费数小时来调试与pip相关的问题,则必须升级它。

apt-get remove python-pip python3-pip
wget https://bootstrap.pypa.io/get-pip.py
python get-pip.py
python3 get-pip.py

如您所见,我提供了有关Python 2.x和3.x的信息

Ubuntu comes with a version of PIP from precambrian and that’s how you have to upgrade it if you do not want to spend hours and hours debugging pip related issues.

apt-get remove python-pip python3-pip
wget https://bootstrap.pypa.io/get-pip.py
python get-pip.py
python3 get-pip.py

As you observed I included information for both Python 2.x and 3.x


回答 1

如果您使用代理,则必须先执行一些额外的配置步骤,然后再开始安装。您必须将环境变量http_proxy设置为代理地址。使用bash可以通过以下命令完成

export http_proxy="http://user:pass@my.site:port/" 

您还可以提供

--proxy=[user:pass@]url:port 

点的参数。该[user:pass@]部分是可选的。

If you are behind a proxy, you must do some extra configuration steps before starting the installation. You must set the environment variable http_proxy to the proxy address. Using bash this is accomplished with the command

export http_proxy="http://user:pass@my.site:port/" 

You can also provide the

--proxy=[user:pass@]url:port 

parameter to pip. The [user:pass@] portion is optional.


回答 2

更新setuptools对我来说效果很好。

sudo pip install --upgrade setuptools

Updating setuptools has worked out fine for me.

sudo pip install --upgrade setuptools

回答 3

首先,由于网络问题而存在此问题,并且卸载和重新安装所有内容都不会有太大帮助。可能您落后于代理,在这种情况下,您需要设置代理。

但就我而言,我面临的问题是因为我没有落后于代理人。通常,我在代理后面工作,但是在家工作时,我在“网络”设置中将代理设置为“无”。

但是即使删除代理设置后,我仍然遇到相同的错误。

所以,当我输入

env | grep proxy

我发现了这样的事情:

http_proxy=http://127.0.0.1:1234/

这就是即使我以为我删除了代理设置,我仍然遇到同样错误的原因。

要取消设置此代理,请输入

unset http_proxy

对于所有其他条目(例如https_proxy),请采用相同的方法。

First of all, this problem exists because of network issues, and uninstalling and re-installing everything won’t be of much help. Probably you are behind proxy, and in that case you need to set proxy.

But in my case, I was facing the problem because I wasn’t behind proxy. Generally, I work behind proxy, but when working from home, I set the proxy to None in Network settings.

But I was still getting the same errors even after removing the proxy settings.

So, when I did type

env | grep proxy

I found something like this :

http_proxy=http://127.0.0.1:1234/

And this was the reason I was still getting the very same error, even when I thought I had removed the proxy settings.

To unset this proxy, type

unset http_proxy

Follow the same approach for all the other entries, such as https_proxy.


回答 4

这里发生的是,在两个不同的位置(相同的代码,但名称不同)导入时,request / urllib3的供应商版本发生冲突。如果随后出现网络错误,它不会重试,但是会因上述错误而失败。请参阅此处,深入了解此错误。

有关使用系统点的解决方案,请参见上文

如果您在由谁构建的virtualenv中有此问题python -m venv/usr/share/python-wheels即使您单独安装了pip,它仍然会从复制车轮),“修复”的最简单方法似乎是:

  1. 创建virtualenv: /usr/bin/python3.6 -m venv ...
  2. 安装requests到环境中(这可能会引发上述错误):<venv>/bin/pip install requests
  3. 删除requestspip将使用的复制版本:rm <venv>/share/python-wheels/{requests,chardet,urllib3}-*.whl

现在,a <venv>/bin/pip使用requests已提供urllib3的已安装版本。

What happens here is that the the vendored versions of request/urllib3 clash when imported in two different places (same code, but different names). If you then have a network error, it doesn’t retry to get the wheel, but fails with the above error. See here for a deeper dive into this error.

For the solution with system pip, see above.

If you have this problem in a virtualenv built by python -m venv (which still copies the wheels from /usr/share/python-wheels, even if you have pip installed separately), the easiest way to “fix” it seems to be:

  1. create the virtualenv: /usr/bin/python3.6 -m venv ...
  2. install requests into the environment (this might raise the above error): <venv>/bin/pip install requests
  3. remove the copied versions of requests which would be used by pip: rm <venv>/share/python-wheels/{requests,chardet,urllib3}-*.whl

Now a <venv>/bin/pip uses the installed version of requests which has urllib3 vendored.


回答 5

端口443未打开,如果在AWS上,则允许自定义tcp端口443,否则打开出站连接的端口443 …

port 443 is not open, just allow custom tcp port 443 if on AWS else open the port 443 for the outbound connections …


回答 6

只是升级点对我有用:

pip install --upgrade pip

Just upgrade pip worked for me:

pip install --upgrade pip


回答 7

使用pitft.sh / adafruit-pitft.sh从Adafruit安装RaspberryPI TFT时,我遇到同样的问题。

我不满意编码样式的错误,该错误来自某个地方,可以以某种方式解释-如前面的答案所示。

备注:的类型错误异常retry.py显然是一个错误,所造成的类的实例的unappropriate assignement和计算回复INT与默认值10 -在代码的某个地方……应该是固定的通过添加就地运算符或修正错误的分配。

因此,尝试首先分析和修补错误本身。在我的案例中,实际的错误是pip调用的相同的-retry.py

安装脚本adafruit-pitft.sh / pitft.sh尝试应用urllib3,后者本身尝试通过pip安装嵌套的依赖项,因此出现相同的错误。

adafruit-pitft.sh#或pitft.sh

_stacktrace = sys.exc_info()[2])文件“ /usr/share/python-wheels/urllib3-1.13.1-py2.py3 none-any.whl / urllib3 / util / retry.py”,第228行,增量

总计-= 1

TypeError:-=:“重试”和“ int”的不受支持的操作数类型

对于当前发行版(基于debian-9.6.0 / stretch):

文件“ /usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/util/retry.py”,行315,增量

总计-= 1

TypeError:-=:“重试”和“ int”的不受支持的操作数类型

以下-脏* :)-修补程序启用探测错误跟踪:

# File: retry.py - in *def increment(self, ..* about line 315
# original: total = self.total

# patch: quick-and-dirty-fix
# START:
if isinstance(self.total, Retry):
    self.total = self.total.total

if type(self.total) is not int:
    self.total = 2 # default is 10
# END:

# continue with original:
total = self.total

if total is not None:
    total -= 1

connect = self.connect
read = self.read
redirect = self.redirect
cause = 'unknown'
status = None
redirect_location = None

if error and self._is_connection_error(error):
    # Connect retry?
    if connect is False:
        raise six.reraise(type(error), error, _stacktrace)
    elif connect is not None:
        connect -= 1

带有临时补丁的声音输出为(显示两次…?):

连接被’ConnectTimeoutError(<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at /

连接被’ConnectTimeoutError(<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at /

找不到满足evdev要求的版本(来自版本:)

找不到与evdev匹配的分布

警告:Pip无法安装软件!

因此,就我而言,实际上是由两件事引起的错误,这在其他环境中可能会有所不同:

  1. 缺少evdev =>尝试安装
  2. 无法连接包含evdev的repo / dist 进行下载。=>最终放弃

我的安装环境是从内部debian + raspbian镜像脱机的,因此不想设置代理…

所以我着手手动安装缺少的组件evdev

  1. 从PyPI下载evdev(或例如从github.com下载):

    https://pypi.org/project/evdev/

    https://files.pythonhosted.org/packages/7e/53/374b82dd2ccec240b7388c65075391147524255466651a14340615aabb5f/evdev-1.1.2.tar.gz

  2. root用户身份解压缩并手动安装-对于所有本地帐户,因此被检测为已安装:

    苏多苏-

    tar xf evdev-1.1.2.tar.gz

    光盘evdev-1.1.2

    python setup.py安装

  3. 再次调用安装脚本:

    adafruit-pitft.sh#或pitft.sh

    回答对话

    …而已。

如果您通过直接PyPI访问进行在线操作:

  1. 检查您的路由和防火墙以访问pypi.org

  2. 根据需要设置代理(http_proxy / https_proxy)

而且有效。

希望这在其他情况下也有帮助。

阿尔诺·坎·乌斯图恩斯

———————————————-

另请参阅:问题-35334:https://bugs.python.org/issue35334

———————————————-

现在另请参阅:问题-1486:https : //github.com/urllib3/urllib3/issues/1486

用于文件:https : //github.com/urllib3/urllib3/blob/master/src/urllib3/util/retry.py

I have the same problem when installing a RaspberryPI TFT from Adafruit with pitft.sh / adafruit-pitft.sh.

I am not happy about coding-styles with errors from somewhere to be interpreted somehow – as could be seen by the previous answers.

Remark: The type error exception of retry.py is obviously a bug, caused by an unappropriate assignement and calculation of an instance of the class Reply to an int with the default value of 10 – somewhere in the code… Should be fixed either by adding an inplace-operator, or fixing the erroneous assignment.

So tried to analyse and patch the error itself first. The actual error in my case case is the same – retry.py called by pip.

The installation script adafruit-pitft.sh / pitft.sh tries to apply urllib3 which itself tries to install nested dependencies by pip, so the same error.

adafruit-pitft.sh # or pitft.sh

_stacktrace=sys.exc_info()[2]) File “/usr/share/python-wheels/urllib3-1.13.1-py2.py3 none-any.whl/urllib3/util/retry.py”, line 228, in increment

total -= 1

TypeError: unsupported operand type(s) for -=: ‘Retry’ and ‘int’

For the current distribution(based on debian-9.6.0/stretch):

File “/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/util/retry.py”, line 315, in increment

total -= 1

TypeError: unsupported operand type(s) for -=: ‘Retry’ and ‘int’

The following – dirty *:) – patch enables a sounding error trace:

# File: retry.py - in *def increment(self, ..* about line 315
# original: total = self.total

# patch: quick-and-dirty-fix
# START:
if isinstance(self.total, Retry):
    self.total = self.total.total

if type(self.total) is not int:
    self.total = 2 # default is 10
# END:

# continue with original:
total = self.total

if total is not None:
    total -= 1

connect = self.connect
read = self.read
redirect = self.redirect
cause = 'unknown'
status = None
redirect_location = None

if error and self._is_connection_error(error):
    # Connect retry?
    if connect is False:
        raise six.reraise(type(error), error, _stacktrace)
    elif connect is not None:
        connect -= 1

The sounding output with the temporary patch is(displayed twice…?):

Retrying (Retry(total=1, connect=None, read=None, redirect=None)) after connection broken by ‘ConnectTimeoutError(<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at/

Retrying (Retry(total=0, connect=None, read=None, redirect=None)) after connection broken by ‘ConnectTimeoutError(<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at/

Could not find a version that satisfies the requirement evdev (from versions: )

No matching distribution found for evdev

WARNING : Pip failed to install software!

So in my case actually two things cause the error, this may vary in other environments:

  1. Missing evdev => try to install
  2. Failed to connect a repo/dist containing evdev in order to download. => finally give it up

My installation environment is offline from an internal debian+raspbian mirror, thus do not want to set the proxy…

So I proceeded by manual installation of the missing component evdev:

  1. download evdev from PyPI(or e.g. from github.com):

    https://pypi.org/project/evdev/

    https://files.pythonhosted.org/packages/7e/53/374b82dd2ccec240b7388c65075391147524255466651a14340615aabb5f/evdev-1.1.2.tar.gz

  2. Unpack and install manually as root user – for all local accounts, so detected as installed:

    sudo su –

    tar xf evdev-1.1.2.tar.gz

    cd evdev-1.1.2

    python setup.py install

  3. Call install script again:

    adafruit-pitft.sh # or pitft.sh

    …Answer dialogues…

    …that’s it.

If you proceed online by direct PyPI access:

  1. check your routing + firewall for access to pypi.org

  2. set a proxy if required (http_proxy/https_proxy)

And it works..

Hope this helps in other cases too.

Arno-Can Uestuensoez

———————————————-

See also: issue – 35334: https://bugs.python.org/issue35334

———————————————-

See now also: issue – 1486: https://github.com/urllib3/urllib3/issues/1486

for file: https://github.com/urllib3/urllib3/blob/master/src/urllib3/util/retry.py


回答 8

检查网络问题,绕过异常案例代码

就我而言,我使用的是自定义索引,该索引没有路由,因此会触发异常案例代码。异常情况错误仍然存​​在,并且仍然掩盖了实际问题,但是我能够通过测试与其他工具的连接性来解决此问题,例如nc -vzw1 myindex.example.org 443在网络启动时重试。

check for network issues, to bypass the exception case code

In my case, I was using a custom index, that index had no route and such would trigger the exception case code. The exception case bug still exists and still masks the real issue, however I was able to work around this by testing the connectivity with other tools such as nc -vzw1 myindex.example.org 443 and retrying when the network was up.


回答 9

尝试在ec2实例上安装awscli工具时遇到了类似的问题。我更改了安全组,以允许端口443入站和出站访问,这为我解决了这个问题。

I was facing similar issue while trying to install awscli tool on ec2 instance. I changed security group to allow port 443 inbound and outbound access and that solved the issue for me.


回答 10

尝试创建virtualenvwith命令时收到此错误virtualenv myVirtualEnv。我只是sudo在命令前添加了一个;它解决了一切。

I got this error when I was trying to create a virtualenv with command virtualenv myVirtualEnv. I just added a sudo before the command; it solved everything.


回答 11

解决方案:
1. sudo apt remove python-pip
2. pip3 install pip(或通过get-pip.py安装pip )

原因:
此错误发生在apt-get安装的pip 8.0.1上。并且仅在您的网络不稳定时才发生。

如果您安装了带有apt的pip,则它将以其他方式隐藏您安装的pip,因此您应该首先删除该apt。

我断开了网络连接,并测试了通过pip3或get-pip.py安装的3个版本的8.0.1、9.0.3、10.x,没有发生错误。因此,我认为只有apt版本的pip 8.0.1才有该错误,其他都可以。

Solution:
1. sudo apt remove python-pip
2. pip3 install pip (or install pip by get-pip.py)

Why:
This error occurred on pip 8.0.1 which installed by apt-get. And happened only when your network is unstable.

If you have a pip installed with apt, it hides the pip you installed by other ways, so you should remove the apt one first.

I disconnected the network and tested 8.0.1, 9.0.3, 10.x the 3 versions installed with pip3 or get-pip.py, no error occurred. So, I think only the apt version of pip 8.0.1 has that bug, the others is ok.


回答 12

就我而言,我以sudo模式打开了Pycharm,并在pycharm终端中运行了pip install nltk,该错误显示了此错误。使用sudo pip install运行可解决该错误。

In my case, i had opened Pycharm in sudo mode, and was running pip install nltk in pycharm terminal which showed this error. running with sudo pip install solves the error.


回答 13

我也有这个问题。最初,已设置代理,并且可以正常工作。然后,我连接到不通过代理的网络。取消设置代理点后,即可再次使用。

unset http_proxy; unset http_prox;  unset HTTP_PROXY; unset HTTPS_PROXY

I also had this issue. Initially, a proxy was set and work fine. Then I connected to a network where it doesn’t go through a proxy. After unsetting proxy pip again get works.

unset http_proxy; unset http_prox;  unset HTTP_PROXY; unset HTTPS_PROXY

回答 14

奇怪的是,如果我从环境中删除代理并将其添加到命令行,那么它对我有用。例如要pip自我升级:

env http_proxy= https_proxy= pip install pip --upgrade --proxy 'http://proxy-url:80'

我的问题是在环境中使用代理。看来,点子只是在参数中尊重那个人。

Bizarrely if I remove the proxy from the environment and add it to the command line it works for me. For example to upgrade pip itself:

env http_proxy= https_proxy= pip install pip --upgrade --proxy 'http://proxy-url:80'

My issue was having the proxy in the environment. It seems that pip only honors the one in argument.


回答 15

这是我发现的此问题的有效解决方案。

sudo apt-get clean
cd /var/lib/apt
sudo mv lists lists.old
sudo mkdir -p lists/partial
sudo apt-get clean
sudo apt-get update

This is the working solution to this problem I found.

sudo apt-get clean
cd /var/lib/apt
sudo mv lists lists.old
sudo mkdir -p lists/partial
sudo apt-get clean
sudo apt-get update

回答 16

对我自己来说,原来wlan0掉了下来,这导致我无法连接。因此,确保wlan0启动,允许pip / pip3正常工作。

For myself, it turns out that wlan0 was down, which resulted in me being unable to connect out. So, ensuring that wlan0 was up, allowed pip / pip3 to work without issue.


回答 17

我尝试了上面回答的解决方案:

apt-get remove python-pip python3-pip
wget https://bootstrap.pypa.io/get-pip.py
python get-pip.py
python3 get-pip.py

当我尝试

python get-pip.py 
python3 get-pip.py

我收到此消息

 Could not install packages due to an EnvironmentError:
[Errno 13] Permission denied: /usr/bin/pip3 Consider using the --user
 option or check the permissions.

我做了以下工作

python3 -m venv env
source ./env/bin/activate
Sudo apt-get update 
apt-get remove python-pip python3-pip
wget https://bootstrap.pypa.io/get-pip.py
python get-pip.py
python3 get-pip.py
pip3 install pip
sudo easy_install pip
pip install --upgrade pip

I tried the solution answered above:

apt-get remove python-pip python3-pip
wget https://bootstrap.pypa.io/get-pip.py
python get-pip.py
python3 get-pip.py

When I tried

python get-pip.py 
python3 get-pip.py

I got this message

 Could not install packages due to an EnvironmentError:
[Errno 13] Permission denied: /usr/bin/pip3 Consider using the --user
 option or check the permissions.

I did the following and it works

python3 -m venv env
source ./env/bin/activate
Sudo apt-get update 
apt-get remove python-pip python3-pip
wget https://bootstrap.pypa.io/get-pip.py
python get-pip.py
python3 get-pip.py
pip3 install pip
sudo easy_install pip
pip install --upgrade pip

声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。