python - 无法在 virtualenv 中使用 pip 安装软件包

标签 python python-2.7 pip

我尝试在虚拟环境中使用 pip 安装各种 python 软件包,但无法安装。如果我尝试不在虚拟环境中安装相同的软件包,那么它就会被安装。每次我都会遇到不同的错误。我将安装 scrapy 时遇到的错误之一粘贴到下面。

Command "/home/namita/venv/bin/python -c "import setuptools, tokenize;file='/tmp/pip-build-AHL0d8/cffi/setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record /tmp/pip-Dk98DU-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/namita/venv/include/site/python2.7/cffi" failed with error code 1 in /tmp/pip-build-AHL0d8/cffi

我还收到下面提到的警告:

/home/namita/venv/local/lib/python2.7/site-packages/pip/vendor/requests/packages/urllib3/util/ssl.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning. InsecurePlatformWarning

我尝试访问https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning但并不满足。

最佳答案

I tried visiting https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning but was not satisfied.

解决方案非常明确:

If you encounter this warning, it is strongly recommended you upgrade to a newer Python version, or that you use pyOpenSSL as described in the OpenSSL / PyOpenSSL section.

如果您不想升级 Python 版本 (>2.7.9),请安装以下软件包:

$ pip install pyopenssl ndg-httpsclient pyasn1

它已被证明可以解决其他类似问题:

关于python - 无法在 virtualenv 中使用 pip 安装软件包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31334914/

相关文章:

python - 给定其功能之一,如何在类外部获取类名

Python:使用 '.join' 处理数据(TypeError:序列项 0:预期字符串,找到元组)

javascript - 如何将数据从ajax传递到django View ?

Python raise 有两个参数

Python - 代码中的多个 SQL 查询

python - 无法在树莓派上使用pip安装PyQt5

python - 如何在丢失文件的情况下强制 pip 卸载

python - 为什么使用 numpy.ndarray.astype 将 numpy.ndarray 转换为自定义数据类型会使我的数据相乘?

python - 我怎样才能对字典中的数字列表进行平方?

python - 在 Mac OS X 10.9 上使用 pip 安装 Python 图像库时出错