Error when installing using pip

2019-01-22 14:23发布

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

7条回答
狗以群分
2楼-- · 2019-01-22 14:55

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

查看更多
Ridiculous、
3楼-- · 2019-01-22 15:01

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
查看更多
Melony?
4楼-- · 2019-01-22 15:01

If you get this error on Windows, like I did, then just run the command-line tool (cmd.exe or Powershell) as Administrator and try again.

查看更多
聊天终结者
5楼-- · 2019-01-22 15:12

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>>

查看更多
ゆ 、 Hurt°
6楼-- · 2019-01-22 15:15

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.

查看更多
Juvenile、少年°
7楼-- · 2019-01-22 15:18

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

查看更多
登录 后发表回答