这是PATH没有sudo 的变量:
$ echo 'echo $PATH' | sh
/opt/local/ruby/bin:/usr/bin:/bin
Run Code Online (Sandbox Code Playgroud)
这是PATHsudo 的变量:
$ echo 'echo $PATH' | sudo sh
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin
Run Code Online (Sandbox Code Playgroud)
据我所知,sudo应该PATH保持不变.这是怎么回事?我该如何改变?(这是在Ubuntu 8.04上).
更新:据我所知,没有任何脚本PATH以任何方式作为root更改.
来自man sudo:
为了防止命令欺骗,当在用户的PATH中搜索命令时(如果一个或两个都在PATH中),sudo会检查``.''和``''(都表示当前目录).但请注意,实际的PATH环境变量未被修改,并且不会更改地传递给sudo执行的程序.
当我尝试以任何方式使用pip时,我遇到了问题.我正在使用Ubuntu 16.04.4
我应该说我已经使用过了,我从来没有遇到过任何问题,但是从今天开始,当我使用任何命令时,我总会得到相同的错误(例如使用pip --upgrade).
Traceback (most recent call last):
File "/usr/local/bin/pip", line 7, in <module>
from pip._internal import main
ImportError: No module named _internal
Run Code Online (Sandbox Code Playgroud)
我尝试过sudo apt-get remove python-pip后续sudo apt-get install python-pip但没有改变.
感谢您的时间!
pip install <package name>对我而言,每个包都失败了.这就是我得到的:
Could not find a version that satisfies the requirement <package-name
(from versions: )
No matching distribution found for <package-name>
Run Code Online (Sandbox Code Playgroud)
我在Stack Overflow上看到了 类似的 问题,但它们似乎与这个问题没有完全相关.
此外,这篇文章表明,如果PyPI关闭或我的IP地址被列入黑名单,可能会发生这种情况.对我来说,这似乎都不正确.
pip显示最新的运行情况pip install --upgrade pip.
我的控制台:
desarrollador @ desarrollador-HP-14-Notebook-PC1:〜$ pip freeze
Exception:
Traceback(最近一次调用最后一次):
文件"/usr/lib/python2.7/dist-packages/pip/basecommand.py",第126行,在main
self.run(options,args)
文件"/usr/lib/python2.7/dist-packages/pip/commands/freeze.py",第68行,在run
req = pip.FrozenRequirement.from_dist(dist, dependency_links,find_tags = find_tags)
文件"/usr/lib/python2.7/dist-packages/pip/ INIT py"为,线156,在from_dist
断言LEN(规格)== 1和规格[0] [0] = ='=='
AssertionError
我安装了龙卷风包,从那以后就发生了.我该如何解决?
我通过以下命令安装了弹性搜索策展人.
sudo pip install -U elasticsearch-curator
Run Code Online (Sandbox Code Playgroud)
这一切都安装好了.
但是现在当我做以下事情时
curator_cli --version
Run Code Online (Sandbox Code Playgroud)
我得到以下依赖警告.
/usr/local/lib/python2.7/dist-packages/requests/__init__.py:83: RequestsDependencyWarning: Old version of cryptography ([1, 2, 3]) may cause slowdown.
warnings.warn(warning, RequestsDependencyWarning)
curator_cli, version 5.5.4
Run Code Online (Sandbox Code Playgroud)
如何修复警告或隐藏警告?
我正在尝试安装 jupyterthemes 包并收到此错误。

Collecting jupyterthemes
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))': /packages/8a/08/9dee6dfd7f2aad6c30282d55c8f495b4dc1e4747b4e2bdbeb80572ddf312/jupyterthemes-0.20.0-py2.py3-none-any.whl
Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))': /packages/8a/08/9dee6dfd7f2aad6c30282d55c8f495b4dc1e4747b4e2bdbeb80572ddf312/jupyterthemes-0.20.0-py2.py3-none-any.whl
Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the …Run Code Online (Sandbox Code Playgroud) 我早先在我的OSX上安装了pip,但它不能以某种方式工作.所以,我试图再次使用命令安装pip:
sudo easy_install pip
Run Code Online (Sandbox Code Playgroud)
但它给我的错误如下:
pip 9.0.1 is already the active version in easy-install.pth
Installing pip script to /usr/local/bin
error: [Errno 2] No such file or directory: '/usr/local/bin/pip'
Run Code Online (Sandbox Code Playgroud)
我既不能使用pip,也不能安装它.