- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我使用的是 Ubuntu 14.04LTS,安装了系统 Python 和 Anaconda Python。在未能让 virtualenv 与其中任何一个一起使用之后,我决定单独安装从源代码构建的 Python 2.7.11,以便使用 virtualenv。不幸的是,它还没有完全处于工作状态。当我尝试创建 virtualenv 时,它抛出 UnicodeEncodeError。我已将错误源隔离到 virtualenv 安装程序尝试安装 setuptools 时的部分。也就是说,如果我首先添加 --no-setuptools
开关:
/usr/local/lib/python2.7.11/bin/virtualenv --no-setuptools 测试
其次是
/home/leo/tmp/test/bin/pip install setuptools # 在没有 sudo 的情况下失败
我得到以下回溯:
Exception:
Traceback (most recent call last):
File "/home/leo/tmp/test/lib/python2.7/site-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/home/leo/tmp/test/lib/python2.7/site-packages/pip/commands/install.py", line 310, in run
wb.build(autobuilding=True)
File "/home/leo/tmp/test/lib/python2.7/site-packages/pip/wheel.py", line 750, in build
self.requirement_set.prepare_files(self.finder)
File "/home/leo/tmp/test/lib/python2.7/site-packages/pip/req/req_set.py", line 370, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "/home/leo/tmp/test/lib/python2.7/site-packages/pip/req/req_set.py", line 522, in _prepare_file
finder, self.upgrade, require_hashes)
File "/home/leo/tmp/test/lib/python2.7/site-packages/pip/req/req_install.py", line 268, in populate_link
self.link = finder.find_requirement(self, upgrade)
File "/home/leo/tmp/test/lib/python2.7/site-packages/pip/index.py", line 442, in find_requirement
all_candidates = self.find_all_candidates(req.name)
File "/home/leo/tmp/test/lib/python2.7/site-packages/pip/index.py", line 400, in find_all_candidates
for page in self._get_pages(url_locations, project_name):
File "/home/leo/tmp/test/lib/python2.7/site-packages/pip/index.py", line 545, in _get_pages
page = self._get_page(location)
File "/home/leo/tmp/test/lib/python2.7/site-packages/pip/index.py", line 648, in _get_page
return HTMLPage.get_page(link, session=self.session)
File "/home/leo/tmp/test/lib/python2.7/site-packages/pip/index.py", line 757, in get_page
"Cache-Control": "max-age=600",
File "/home/leo/tmp/test/lib/python2.7/site-packages/pip/_vendor/requests/sessions.py", line 487, in get
return self.request('GET', url, **kwargs)
File "/home/leo/tmp/test/lib/python2.7/site-packages/pip/download.py", line 378, in request
return super(PipSession, self).request(method, url, *args, **kwargs)
File "/home/leo/tmp/test/lib/python2.7/site-packages/pip/_vendor/requests/sessions.py", line 475, in request
resp = self.send(prep, **send_kwargs)
File "/home/leo/tmp/test/lib/python2.7/site-packages/pip/_vendor/requests/sessions.py", line 585, in send
r = adapter.send(request, **kwargs)
File "/home/leo/tmp/test/lib/python2.7/site-packages/pip/_vendor/cachecontrol/adapter.py", line 36, in send
cached_response = self.controller.cached_request(request)
File "/home/leo/tmp/test/lib/python2.7/site-packages/pip/_vendor/cachecontrol/controller.py", line 111, in cached_request
resp = self.serializer.loads(request, cache_data)
File "/home/leo/tmp/test/lib/python2.7/site-packages/pip/_vendor/cachecontrol/serialize.py", line 114, in loads
return getattr(self, "_loads_v{0}".format(ver))(request, data)
File "/home/leo/tmp/test/lib/python2.7/site-packages/pip/_vendor/cachecontrol/serialize.py", line 176, in _loads_v2
cached["response"]["body"]
File "/home/leo/tmp/test/lib/python2.7/site-packages/pip/_vendor/cachecontrol/serialize.py", line 26, in _b64_decode_bytes
return base64.b64decode(b.encode("ascii"))
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-28790: ordinal not in range(128)
但是,在 sudo 下运行它可以正常工作。但是,这意味着每次设置虚拟环境时我都必须执行 sudo 解决方法,这是次优的。
我尝试过的事情:确保我构建的 python 支持 UCS4,确保 LC_ALL 和 LANG 变量是 en_US.UTF-8。
最佳答案
耶!!找到答案了!!我遇到了同样的问题,这让我很震惊!我的 pip 缓存已损坏。所以我删除了以下文件夹并重新安装了 virtualenv :)
你这边奇怪的事情是,你似乎将系统的 python 与你的 python 混合在一起(/usr/lib 是系统,$HOME/mypython 应该是你的本地构建)。为了确保您不会踩到系统的脚,在构建之前,您应该在运行“./configure”步骤时添加“--prefix=$HOME/mypython”。那么你所有的Python安装都将在$HOME/mypython中,并且不需要任何sudo权限(在/usr上写入需要sudo权限)
如果你从源代码构建了 python,我建议从中安装 pip 和 virtualenv
# let's assume your python installation is in this variable
my_python_path=/home/leo/tmp/test/
rm -Rf $HOME/.cache/pip
# not sure of the deletion of this one, but did it to be sure
rm -Rf $HOME/.pip
# remove of the pip and virtualenv
rm $my_python_path/bin/pip
rm $my_python_path/bin/virtualenv
# reinstall pip
$my_python_path/bin/python -m ensure pip
$my_python_path/bin/pip install virtualenv
$my_python_path/bin/virtualenv myenv
我还使用 Ubuntu 14.04 和从源代码构建的 python 2.7.13 版本。
关于python - 无法为Python 2.7创建虚拟环境: setuptools fails with UnicodeEncodeError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37873500/
我在文档中找不到答案,所以我在这里问。 在 Grails 中,当您创建应用程序时,您会默认获得生产、开发等环境。 如果您想为生产构建 WAR,您可以运行以下任一命令: grails war 或者 gr
我们组织的网站正在迁移到 Sitecore CMS,但我们正在努力以某种方式为开发人员 (4)、设计师 (4)、QA 人员 (3)、作者 (10-15) 和批准者 (4-10) 设置环境在他们可以独立
如何在WinCVS中设置CVSROOT环境变量? 最佳答案 简单的回答是:您不需要。 CVSROOT 环境变量被高估了。 CVS(NT) 只会在确定存储库连接字符串的所有其他方法都已用尽时才使用它。人
我最近完成了“learnyouahaskell”一书,现在我想通过构建 yesod 应用程序来应用我所学到的知识。 但是我不确定如何开始。 关于如何设置 yesod 项目似乎有两个选项。一是Stack
在这一章中,我们将讨论创建 C# 编程所需的工具。我们已经提到 C# 是 .Net 框架的一部分,且用于编写 .Net 应用程序。因此,在讨论运行 C# 程序的可用工具之前,让我们先了解一下 C#
运行Ruby 代码需要配置 Ruby 编程语言的环境。本章我们会学习到如何在各个平台上配置安装 Ruby 环境。 各个平台上安装 Ruby 环境 Linux/Unix 上的 Ruby 安装
就目前而言,这个问题不适合我们的问答形式。我们希望答案得到事实、引用或专业知识的支持,但这个问题可能会引起辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the he
我有一个这样的计算(请注意,这只是非常简化的、缩减版的、最小的可重现示例!): computation <- function() # simplified version! { # a lo
我使用环境作为哈希表。键是来自常规文本文档的单词,值是单个整数(某个其他结构的索引)。 当我加载数百万个元素时,更新和查找都变慢了。下面是一些代码来显示行为。 看起来从一开始的行为在 O(n) 中比在
我正在构建一个 R 包并使用 data-raw和 data存储预定义的库 RxODE楷模。这非常有效。 然而,由此产生的.rda文件每代都在变化。某些模型包含 R 环境,并且序列化似乎包含“创建时间”
(不确定问题是否属于这里,所以道歉是为了) 我很喜欢 Sublime Text ,我经常发现 Xcode 缺少一些文本/数据处理的东西。我可能有不止一个问题—— 'Command +/' 注释代码但没
我正在使用 SF2,并且创建了一些有助于项目调试的路由: widget_debug_page: path: /debug/widget/{widgetName} defau
我创建了一个名为 MyDjangoEnv 的 conda 环境。当我尝试使用 source activate MyDjangoEnv 激活它时,出现错误: No such file or direct
有没有办法区分从本地机器运行的包和从 Cordova 应用商店安装的包? 例如,我想像这样设置一个名为“evn”的 JavaScript 变量: if(cordovaLocal){ env = 'de
很难说出这里要问什么。这个问题模棱两可、含糊不清、不完整、过于宽泛或夸夸其谈,无法以目前的形式得到合理的回答。如需帮助澄清此问题以便重新打开,visit the help center . 关闭 1
我的任务是使用 java 和 mysql 开发一个交互式网站:使用 servlet 检索和处理数据,applet 对数据客户端进行特殊处理,并处理客户端对不同数据 View 的请求。 对于使用 jav
这按预期工作: [dgorur@ted ~]$ env -i env [dgorur@ted ~]$ 这样做: [dgorur@ted ~]$ env -i which date which: no
我想进行非常快速的搜索,看来使用哈希(通过环境)是最好的方法。现在,我得到了一个在环境中运行的示例,但它没有返回我需要的内容。 这是一个例子: a system.time(benchEnv(), g
我想开始开发 OpenACC 程序,我有几个问题要问:是否可以在 AMD gpu 上执行 OpenACC 代码? 如果是这样,我正在寻找适用于 Windows 环境的编译器。我花了将近一个小时什么也没
这可能看起来很奇怪,但是有没有办法制作机器(linux/unix 风格 - 最好是 RHEL)。我需要控制机器的速度以确保代码在非常慢的系统上工作并确定正确的断点(在时间方面)。 我能做到的一种方法是
我是一名优秀的程序员,十分优秀!