首页 \ 问答 \ pip说这个模块已经安装了python(pip says that module has already been installed while python)

pip说这个模块已经安装了python(pip says that module has already been installed while python)

现在我的当前设置的一些背景:我在Centos 6上运行Python3.3。我目前正在使用Flask运行的Web应用程序,它运行在Apache 2.2.15上,模式为WSGI 4.5.3和virtualenv 15.0.2。

pip --version pip 8.1.2 from /usr/local/bin/lib/python3.3/site-packages (python 3.3)

我用pip安装了pysvn,当我运行pip show pysvn

Location: /usr/local/bin/lib/python3.3/site-packages

递归设置为/usr/local/bin/lib/python3.3/site-packages 755权限。 我将--system-site-packages参数传递给virtualenv以使用全局站点包。

即使我尝试从python解释器导入包它也不起作用。 因此,它不是特定于我的virtualenv设置,而是一个全局问题。

我必须提一下,使用pip安装的其他软件包工作完全正常(即烧瓶)。

在向你们展示之前,我已经筋疲力尽了所有其他途径。 任何建议都会受到高度赞赏,因为我没有想法。

LE

我确实设法安装它。 我不完全确定为什么以及如何,但我认为是兼容性问题。

首先,我已经卸载了svn 1.6+并安装了1.8.16版本,而这似乎是针对最新的两个版本进行测试的。

其次,我已经卸载了麻烦的pysvn实例并安装了pysvn-1.8.0工作台“sudo / var / www / FlaskApp / FlaskApp / flask / bin / pip install pysvn-1.8.0.tar.gz”。 在这种情况下,我已经安装了我的本地环境。 pysvn的1.9.0版本无效。

LLE

误报,仍然不起作用。 我将通过命令行从我的脚本与svn进行交互。

LLLE安装svn 1.8.16和svn-devel以及自述文件中描述的其余依赖项之后,我已经设法从源代码中成功安装它,不再使用说明。

谢谢你的帮助巴里。


Now a bit of background of my current setup: I have Python3.3 running on Centos 6. I'm currently working on a web application using Flask that runs on Apache 2.2.15 with mode WSGI 4.5.3 and virtualenv 15.0.2.

pip --version pip 8.1.2 from /usr/local/bin/lib/python3.3/site-packages (python 3.3)

I have installed pysvn with pip and when I run pip show pysvn says

Location: /usr/local/bin/lib/python3.3/site-packages

755 permissions recursively set to /usr/local/bin/lib/python3.3/site-packages. And I passed --system-site-packages argument to virtualenv to use the global site packages.

Even when I try to import the package from python interpreter it does not work. So it is not specific to my virtualenv setup but rather a global problem.

I must mention that other packages installed with pip work perfectly fine (i.e. flask).

I've exhausted all other avenues before coming forward to you guys. Any suggestion would be highly appreciated as I ran out of ideas.

L.E.

I did manage to install it in the end. I'm not completly sure yet why and how but I presume is was compatibility issue.

First of all I have uninstalled svn 1.6+ and installed version 1.8.16 instead which seems to be tested against the latest two versions.

Second, I have uninstalled the troublesome pysvn instance and installed pysvn-1.8.0 workbench "sudo /var/www/FlaskApp/FlaskApp/flask/bin/pip install pysvn-1.8.0.tar.gz". In this case I have installed it my local environment. The 1.9.0 version of pysvn did not work.

L.L.E.

False positive, still doesn't work. I'm going to interact with svn via command line from my script.

L.L.L.E. After installing svn 1.8.16 and svn-devel along with the rest of dependencies described in the readme file I have managed to successfully install it from the source fallowing the instructions.

Thanks for your help Barry.


原文:https://stackoverflow.com/questions/39062764
更新时间:2021-12-12 07:12

最满意答案

这不仅仅是hashlib - Python 2通过尝试将其编码为ascii来处理许多地方的Unicode。 这是对Python 3做出的重大改变之一。

在Python 3中,字符串是unicode,它们的行为与您的预期相同:没有自动转换为字节,如果要使用字节(例如,用于MD5散列),则必须对它们进行编码。 我相信有使用sys.setdefaultencoding黑客可以在Python 2中启用此行为,但我建议不要在生产中使用它们,因为它们会影响在该Python实例中运行的任何代码。


It's not just hashlib - Python 2 handles Unicode in a number of places by trying to encode it as ascii. This was one of the big changes made for Python 3.

In Python 3, strings are unicode, and they behave as you expect: there's no automatic conversion to bytes, and you have to encode them if you want to use bytes (e.g. for MD5 hashing). I believe there are hacks using sys.setdefaultencoding that enable this behaviour in Python 2, but I'd advise against using them in production, because they'll affect any code running in that Python instance.

相关问答

更多
  • 在asp.net mvc中你传递模型来查看如下: public ActionResult Base() { return View(new DerviedOne()); } 这是您的模型定义: public class BaseModel { public int Id { get; set; } } public class DerviedOne : BaseModel { ...
  • Python输出是摘要的原始字节。 R 摘要函数也支持raw参数。 digest("asdf", algo="sha256", serialize=FALSE, raw=TRUE) The Python output is the raw bytes of the digest. The R digest function also supports this with the raw argument. digest("asdf", algo="sha256", serialize=FALSE, raw ...
  • 如果你想要这个更简单的方法来概括它,所以你可以从中获得更多的使用,而不是将其定制到特定的东西。 那么问题不是“我应该为这个具体的事情做一个全新的班级吗?” 但“我应该用我的公用事业吗?”; 后者总是是的。 实用程序总是有帮助的。 所以做一些像: template void check_range(const T& pX, const T& pMin, const T& pMax) { if (pX < pMin || pX > pMax) throw std ...
  • Python是强大的动态类型。 强打字意味着值的类型不会突然改变。 一个只包含数字的字符串并不奇怪地成为一个数字,正如在Perl中可能发生的那样。 每种类型的更改都需要明确的转换。 动态输入意味着运行时对象(值)具有类型,而不是静态类型,其中变量具有类型。 至于你的例子 bob = 1 bob = "bob" 这是因为变量没有类型; 它可以命名任何对象。 在bob=1 ,你会发现type(bob)返回int ,但是在bob="bob" ,它返回str 。 (请注意, type是一个常规函数,因此它将评估其 ...
  • 实际上,_sha模块由shamodule.c提供,_md5由md5module.c和md5.c提供,并且两者都将仅在您的Python未使用OpenSSL进行默认编译时才会生成。 您可以在Python Source tarball中的setup.py中找到详细信息。 if COMPILED_WITH_PYDEBUG or not have_usable_openssl: # The _sha module implements the SHA1 hash algorithm. ...
  • 您可以使用ctypes这样做, C中不需要帮助应用程序: - rehash.py #! /usr/bin/env python ''' A resumable implementation of SHA-256 using ctypes with the OpenSSL crypto library Written by PM 2Ring 2014.11.13 ''' from ctypes import * SHA_LBLOCK = 16 SHA256_DIGEST_LENGTH = 32 ...
  • 这不仅仅是hashlib - Python 2通过尝试将其编码为ascii来处理许多地方的Unicode。 这是对Python 3做出的重大改变之一。 在Python 3中,字符串是unicode,它们的行为与您的预期相同:没有自动转换为字节,如果要使用字节(例如,用于MD5散列),则必须对它们进行编码。 我相信有使用sys.setdefaultencoding黑客可以在Python 2中启用此行为,但我建议不要在生产中使用它们,因为它们会影响在该Python实例中运行的任何代码。 It's not jus ...
  • 以下是您在发布之前应该尝试的内容: Python 2.7: >>> import md5 >>> password = 'fred' >>> nonce = '12345' >>> md5.new(nonce + ':'+ md5.new(password).hexdigest()).hexdigest() '496a1ca20abf5b0b12ab7f9891d04201' Python 2.7和Python 3.6: >>> import hashlib >>> password = 'fred' > ...
  • 在Python 3中,您需要设置b''而不是''作为iter调用的iter值: iter(functools.partial(f.read, 256), b'') 你也不应该使用列表理解来解决这样的副作用,但是如果你正在移植现有的代码,那么最好现在就离开它。 On Python 3, you need to set b'' instead of '' as the sentinel value for the iter call: iter(functools.partial(f.read, 256), ...
  • import sys from os import listdir from os.path import isfile, join import hashlib path = sys.argv[1] #PATH OF THE FILES, ex: /etc/shadow, /bin/*, etc. files = [ f for f in listdir(path) if isfile(join(path,f)) ] my_files = {} for fil in files: with ope ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)