如何在64位计算机上使用32位Python中的virtualenv?

6

我已经花了几个小时在这个问题上苦苦挣扎,仍然没有解决。

第三个错误提示说要复制DLL文件,然而这个文件默认已经存在。

C:\Windows\system32>virtualenv django-josh
New python executable in django-josh\Scripts\python.exe
ERROR: The executable django-josh\Scripts\python.exe is not functioning
ERROR: It thinks sys.prefix is u'c:\\windows\\syswow64\\django-josh' (should be u'c:\\windows\\system32\\django-josh')
ERROR: virtualenv is not compatible with this system or executable
Note: some Windows users have reported this error when they installed Python for "Only this user" or have multiple versions of Python installed. Copying the appropriate PythonXX.dll to the virtualenv Scripts/ directory may fix this problem.

我一直在阅读这篇文章,想要说明的是,我之前已经安装了Python 3,但后来又安装了Python 2.7,并且删除了Python 3。 我想知道是否仍然有Python 3的痕迹留在我的电脑上,即使我找不到任何东西。

更新:我使用以下命令(使用选项)成功使其工作,但我不确定这是否正确。

C:\Windows\system32>virtualenv --distribute C:\Python27\envs\django
New python executable in C:\Python27\envs\django\Scripts\python.exe
Installing setuptools, pip...done.

非常感谢!

3
你能复制并粘贴文本输出到代码块中,而不是截图并作为图像发布吗?这样更容易在任何答案中引用,并且如果其他人也遇到此问题,它将被找到在搜索结果中。 - icktoofay
1个回答

0

--distribute 使用 Distribute,这是 Setuptools 的一个分支,已经不再维护。它已经被合并回 Setuptools 中。一般来说,我建议不要使用此选项。您可以使用 -p 选项并指定可执行文件的路径来指定要使用的 Python 解释器。这样,您就可以确保不会使用 Python 3。看起来您正在 C:\Python27 下创建您的环境,但我不确定您的虚拟环境是否知道仅通过将其放在该位置即可使用 2.7。


我怎样才能确定 Python 3 已经被卸载? - User
激活您的虚拟环境,启动Python shell,然后输入:`import sys; print (sys.version)` - Joe Tricarico

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接