本文最后更新于 506 天前,其中的信息可能已经有所发展或是发生改变
使用pip install安装库时报错:
ERROR: Could not install packages due to an OSError: Missing dependencies for SOCKS support
方法1
完整报错为:
- 缺少代理库,再使用pip install安装pysocks库也是安装不上的,去github上面找到pysocks项目连接,手动安装
# 项目链接
https://github.com/Anorov/PySocks
# 下载下来并且解压 然后进入目录
cd Downloads/PySocks-1.7.0
# 使用管理员权限安装
❯ python3 setup.py install
Warning: 'classifiers' should be a list, got type 'tuple'
running install
error: can't create or remove files in install directory
The following error occurred while trying to add or remove files in the
installation directory:
[Errno 13] Permission denied: '/Library/Python/3.9/site-packages/test-easy-install-56008.write-test'
The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:
/Library/Python/3.9/site-packages/
Perhaps your account does not have write access to this directory? If the
installation directory is a system-owned directory, you may need to sign in
as the administrator or "root" account. If you do not have administrative
access to this machine, you may wish to choose a different installation
directory, preferably one that is listed in your PYTHONPATH environment
variable.
For information on other options, you may wish to consult the
documentation at:
https://setuptools.readthedocs.io/en/latest/deprecated/easy_install.html
Please make the appropriate changes for your system and try again.
❯ sudo python3 setup.py install
Password:
Warning: 'classifiers' should be a list, got type 'tuple'
running install
running bdist_egg
running egg_info
creating PySocks.egg-info
writing PySocks.egg-info/PKG-INFO
writing dependency_links to PySocks.egg-info/dependency_links.txt
writing top-level names to PySocks.egg-info/top_level.txt
writing manifest file 'PySocks.egg-info/SOURCES.txt'
reading manifest file 'PySocks.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
adding license file 'LICENSE'
writing manifest file 'PySocks.egg-info/SOURCES.txt'
installing library code to build/bdist.macosx-10.9-universal2/egg
running install_lib
running build_py
creating build
creating build/lib
copying socks.py -> build/lib
copying sockshandler.py -> build/lib
creating build/bdist.macosx-10.9-universal2
creating build/bdist.macosx-10.9-universal2/egg
copying build/lib/sockshandler.py -> build/bdist.macosx-10.9-universal2/egg
copying build/lib/socks.py -> build/bdist.macosx-10.9-universal2/egg
byte-compiling build/bdist.macosx-10.9-universal2/egg/sockshandler.py to sockshandler.cpython-39.pyc
byte-compiling build/bdist.macosx-10.9-universal2/egg/socks.py to socks.cpython-39.pyc
creating build/bdist.macosx-10.9-universal2/egg/EGG-INFO
copying PySocks.egg-info/PKG-INFO -> build/bdist.macosx-10.9-universal2/egg/EGG-INFO
copying PySocks.egg-info/SOURCES.txt -> build/bdist.macosx-10.9-universal2/egg/EGG-INFO
copying PySocks.egg-info/dependency_links.txt -> build/bdist.macosx-10.9-universal2/egg/EGG-INFO
copying PySocks.egg-info/top_level.txt -> build/bdist.macosx-10.9-universal2/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents...
creating dist
creating 'dist/PySocks-1.7.0-py3.9.egg' and adding 'build/bdist.macosx-10.9-universal2/egg' to it
removing 'build/bdist.macosx-10.9-universal2/egg' (and everything under it)
Processing PySocks-1.7.0-py3.9.egg
Copying PySocks-1.7.0-py3.9.egg to /Library/Python/3.9/site-packages
Adding PySocks 1.7.0 to easy-install.pth file
Installed /Library/Python/3.9/site-packages/PySocks-1.7.0-py3.9.egg
Processing dependencies for PySocks==1.7.0
Finished processing dependencies for PySocks==1.7.0
# 查看是否安装成功
pip3 list
方法2
# 取消所有代理
unset all_proxy && unset ALL_PROXY
# 安装缺失的依赖项
pip3 install pysocks
# 重置代理
source ~/.bashrc
# zsh
source .zshrc