简体   繁体   中英

Error when installing using pip

Not sure whats going on here but I am getting an error every time I try to install something using pip I get the following error:

Command "/usr/bin/python -c "import setuptools, tokenize;__file__='/private/var/folders/b0/5843zgyj1yz3b8q2l7wrtj8h0000gn/T/pip-build-V4hy8S/PySocks/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\\r\\n', '\\n'), __file__, 'exec'))" install --record /var/folders/b0/5843zgyj1yz3b8q2l7wrtj8h0000gn/T/pip-bIOl7C-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/b0/5843zgyj1yz3b8q2l7wrtj8h0000gn/T/pip-build-V4hy8S/PySocks

Seems that your PiP can't access Setuptools as per the "import setuptools" in the error. Try the below first then try running your pip install again.

sudo pip install -U setuptools

Solution from Github Issue

Try

sudo pip install -U setuptools

If this doesn't solve your problem then

Firstly, you need the python-dev package because Pillow needs compile headers defined.

sudo apt-get install python-dev

On Ubuntu 14.04 you need few extra packages to get pillow working. Install all of them with the command:

sudo apt-get install libtiff5-dev libjpeg8-dev zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev python-tk

Launch the command prompt with 'run as administrator' rights before installing. then try the script -

pip install package_name_here

if error is thrown,then import setup tools

pip install -U setuptools

if again error thrown then upgrade your pip installer using this script(personally worked for me)

python -m pip install --upgrade pip

first run as superuser:

sudo su

then :

pip install PyOpenGL PyOpenGL_accelerate

I had the same problem on Windows Git Bash but installing setuptools did not fix it. Then I noticed another error message further up:

building 'twisted.test.raiser' extension error: Microsoft Visual C++ 14.0 is 
required. Get it with "Microsoft Visual C++ Build Tools": 
http://landinghub.visualstudio.com/visual-cpp-build-tools

That link was dead but ultimately this page had a link to the correct download: https://wiki.python.org/moin/WindowsCompilers

I installed Microsoft Build Tools for Visual Studio 2017 and that resolved it.

如果您在Windows上遇到此错误,就像我一样,那么只需以管理员身份运行命令行工具(cmd.exe或Powershell),然后重试。

It majorly depends on the type of packages you suppose to install. Frequently its failing due to the missing of libsasl2-dev a package for authentication abstraction library which use in the Ubuntu version

First, install:

sudo apt-get install libsasl2-dev

then run:

pip install <<\\package_name>>

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