简体   繁体   English

安装python settuptools时发生错误-没有这样的文件或目录:'/usr/local/lib/python2.7/site-packages/test-easy-install-8811.pth'

[英]Error when installing python settuptools - No such file or directory: '/usr/local/lib/python2.7/site-packages/test-easy-install-8811.pth'

I'm trying to install settuptools on a linux machine that I don't have root access. 我正在尝试在没有root访问权限的linux机器上安装settuptools。 I already create the virtual python. 我已经创建了虚拟python。

dgomez:~/download> which python
/home/dgomez/bin/python

when I do the following, I get an error: 当我执行以下操作时,出现错误:

/home/dgomez/bin/python ez_setup.py 

Downloading http://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11-py2.7.egg
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 2] No such file or directory: '/usr/local/lib/python2.7/site-packages/test-easy-install-8816.pth'

The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:

/usr/local/lib/python2.7/site-packages/

This directory does not currently exist.  Please create it and try again, or
choose a different installation directory (using the -d or --install-dir

option). 选项)。

I would like to know how to fix this. 我想知道如何解决这个问题。 I see in other forum where the user fixed it by creating the directory, but in my case I don't have root access for I can't create a directory. 我在其他论坛上看到用户通过创建目录来修复该目录,但是在我的情况下,我没有超级用户访问权限,因为我无法创建目录。 Thanks 谢谢

UPDATE 更新

I ran the python 我跑了蟒蛇

ez_setup.py --install-dir=/home/dgomez/lib/python2.7/site-packages/

Bu still getting an error: Bu仍然出现错误:

You are attempting to install a package to a directory that is not
on PYTHONPATH and which Python does not read ".pth" files from.  The
installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:

/home/dgomez/lib/python2.7/site-packages/

and your PYTHONPATH environment variable currently contains:

''

The error message tells you exactly what to do, use the --install-dir or --prefix option so the package installs to your virtual Python installation instead of the default location. 错误消息会告诉您确切的操作,请使用--install-dir--prefix选项,以便将程序包安装到虚拟Python安装而不是默认位置。

This might look something like this: 这可能看起来像这样:

/home/dgomez/bin/python ez_setup.py --prefix=/home/dgomez

Or with --install-dir : --install-dir

/home/dgomez/bin/python ez_setup.py --install-dir=/home/dgomez/lib/python2.7/site-packages

Note that you may need to modify the directories used in the options above depending on the actual location of the site-packages directory of your Python installation. 请注意,您可能需要修改以上选项中使用的目录,具体取决于Python安装的site-packages目录的实际位置。

edit: To fix the new error you are seeing, you need to add that directory to the PYTHONPATH environment variable, you can do that with the following command: 编辑:要解决新错误,您需要将该目录添加到PYTHONPATH环境变量中,可以使用以下命令进行操作:

export PYTHONPATH=$PYTHONPATH:/home/dgomez/lib/python2.7/site-packages/

If you are using bash on a Mac or GNU/Linux distro, you can add that line to your ~/.bashrc file so that you won't need to run it manually. 如果在Mac或GNU / Linux发行版上使用bash,则可以将该行添加到~/.bashrc文件中,这样就无需手动运行它。

I met the same issue. 我遇到了同样的问题。 Somehow this directory had been deleted, so I did not have pip and setuptools. 不知何故,此目录已被删除,因此我没有pip和setuptools。 The way I solved is to download pip directly from pip website . 我解决的方法是直接从pip网站下载pip。 I solved it by downloading the pip file from get-pip.py . 我通过从get-pip.py下载pip文件解决了该问题。 After downloading, just run this file in your python direction, you can use this setuptools again. 下载后,只需按python方向运行此文件,即可再次使用此setuptools。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在Linux下的/usr/local/lib/python2.7/site-packages下安装Pip - how to Install Pip under /usr/local/lib/python2.7/site-packages in Linux “/lib/python2.7/site-packages/不支持.pth文件”在MacOS上安装pip - “/lib/python2.7/site-packages/ does NOT support .pth files” installing pip on MacOS 安装djangorestframework时出现错误-权限被拒绝:'/ usr / lib / python2.7 / site-packages / djangorestframework-3.6.3.dist-info' - Getting Error while installing djangorestframework - Permission denied: '/usr/lib/python2.7/site-packages/djangorestframework-3.6.3.dist-info' Errno 13 权限被拒绝:'/Library/Python/2.7/site-packages/test-easy-install-18954.pth' - Errno 13 Permission denied: '/Library/Python/2.7/site-packages/test-easy-install-18954.pth' ImportError:dlopen(/usr/local/lib/python2.7/site-packages/_geoslib.so - ImportError: dlopen(/usr/local/lib/python2.7/site-packages/_geoslib.so Python OSX - /usr/local/lib/python2.7/site-packages/easysnmp/interface.so中的平面命名空间 - Python OSX - flat namespace in /usr/local/lib/python2.7/site-packages/easysnmp/interface.so 如何忽略〜/ .local / lib / python2.7 / site-packages中的python模块? - How to ignore python module in ~/.local/lib/python2.7/site-packages? 如何为本地Python 2.7安装设置site-packages目录 - How to set site-packages directory for local Python 2.7 install OSError:[Errno 2]没有这样的文件或目录:'/usr/local/lib/python2.7/dist-packages/pyduino-0.0.0-py2.7.egg' - OSError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/pyduino-0.0.0-py2.7.egg' 导入错误:dlopen(/usr/local/opt/opencv3/lib/python2.7/site-packages/cv2.so, 2):找不到符号:_PyCObject_Type - ImportError: dlopen(/usr/local/opt/opencv3/lib/python2.7/site-packages/cv2.so, 2): Symbol not found: _PyCObject_Type
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM