简体   繁体   中英

Unable to install packages using pip in virtualenv

I am trying to install various python packages using pip in my virtual environment but couldn't install. If I try to install the same package not in virtual environment then it gets installed. Every time I get the different errors. I am pasting one of the errors below which I got while installing 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

And I also get below mentioned warning:

/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

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

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

The solution is quite clear :

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.

If you do not want to upgrade your Python version (>2.7.9), install the following packages :

$ pip install pyopenssl ndg-httpsclient pyasn1

It has been proven to work for other similar issues :

From a fresh installation of 14.04, I had to install python-dev, libffi-dev, libssl-dev, libxml2-dev, and libxslt1-dev packages. Once those were installed, pip install scrapy worked fine.

sudo apt-get install python-dev libffi-dev libssl-dev libxml2-dev libxslt1-dev
pip install scrapy

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM