简体   繁体   English

sys_platform未定义x64 Windows

[英]sys_platform is not defined x64 Windows

This has been bugging me for a little while. 这一直困扰着我。 I recently upgraded to x64 Python, and I started getting this error (example pip install). 我最近升级到x64 Python,我开始收到此错误(示例pip install)。

C:\Users\<uname>\distribute-0.6.35>pip install python-qt
Collecting python-qt
  Downloading python-qt-0.50.tar.gz
Building wheels for collected packages: python-qt
  Running setup.py bdist_wheel for python-qt
  Complete output from command C:\Python27\python.exe -c "import setuptools;__file__='c:\\users\\<uname>\\appdata\\local\\t
emp\\pip-build-vonat7\\python-qt\\setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bd
ist_wheel -d c:\users\<uname>\appdata\local\temp\tmpghy5gtpip-wheel-:
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "c:\users\<uname>\appdata\local\temp\pip-build-vonat7\python-qt\setup.py", line 11, in <module>
      packages=['Qt'],
    File "C:\Python27\lib\distutils\core.py", line 137, in setup
      ok = dist.parse_command_line()
    File "C:\Python27\lib\site-packages\distribute-0.6.35-py2.7.egg\setuptools\dist.py", line 232, in parse_command_line
      result = _Distribution.parse_command_line(self)
    File "C:\Python27\lib\distutils\dist.py", line 467, in parse_command_line
      args = self._parse_command_opts(parser, args)
    File "C:\Python27\lib\site-packages\distribute-0.6.35-py2.7.egg\setuptools\dist.py", line 558, in _parse_command_opts
      nargs = _Distribution._parse_command_opts(self, parser, args)
    File "C:\Python27\lib\distutils\dist.py", line 523, in _parse_command_opts
      cmd_class = self.get_command_class(command)
    File "C:\Python27\lib\site-packages\distribute-0.6.35-py2.7.egg\setuptools\dist.py", line 362, in get_command_class
      ep.require(installer=self.fetch_build_egg)
    File "C:\Python27\lib\site-packages\distribute-0.6.35-py2.7.egg\pkg_resources.py", line 2027, in require
      working_set.resolve(self.dist.requires(self.extras),env,installer))
    File "C:\Python27\lib\site-packages\distribute-0.6.35-py2.7.egg\pkg_resources.py", line 2237, in requires
      dm = self._dep_map
    File "C:\Python27\lib\site-packages\distribute-0.6.35-py2.7.egg\pkg_resources.py", line 2466, in _dep_map
      self.__dep_map = self._compute_dependencies()
    File "C:\Python27\lib\site-packages\distribute-0.6.35-py2.7.egg\pkg_resources.py", line 2499, in _compute_dependencies
      common = frozenset(reqs_for_extra(None))
    File "C:\Python27\lib\site-packages\distribute-0.6.35-py2.7.egg\pkg_resources.py", line 2496, in reqs_for_extra
      if req.marker_fn(override={'extra':extra}):
    File "C:\Python27\lib\site-packages\distribute-0.6.35-py2.7.egg\_markerlib\markers.py", line 109, in marker_fn
      return eval(compiled_marker, environment)
    File "<environment marker>", line 1, in <module>
  NameError: name 'sys_platform' is not defined

  ----------------------------------------
  Failed building wheel for python-qt
Failed to build python-qt
Installing collected packages: python-qt
  Running setup.py install for python-qt
Successfully installed python-qt-0.50

The package was installed fine, but I cannot build wheels. 包裹安装得很好,但我不能建造轮子。 I tried re-installing distribute manually by downloading a zip and running python setup.py install . 我尝试通过下载zip并运行python setup.py install手动重新安装分发。 That installed wonderfuly, without a hitch. 安装奇妙,没有任何障碍。 But I still have the above problem. 但我仍然有上述问题。

How can I re-define sys_platform? 如何重新定义sys_platform?

Alright, I rolled back to x86 good ole 32 bit Python, and I still have the problem. 好吧,我回滚到x86 good ole 32 bit Python,我仍然有问题。 This is really concerning, because I cannot reset this after re-installing. 这真的很令人担忧,因为重新安装后我无法重置它。 I looked at markerlib , which looks promising, but I don't know how to use it safely. 我看了一下看起来很有前途的markerlib ,但我不知道如何安全地使用它。 Currently I am unable to install pretty much anything from PyPI, so I am giving points to increase interest. 目前我无法从PyPI安装任何东西 ,所以我给予积分以增加兴趣。

Any help? 有帮助吗? I really want to be able to use PyPI again. 我真的希望能够再次使用PyPI。

I chose the selected answer as it is the most likely to solve the problem. 我选择了所选答案,因为它最有可能解决问题。 I myself have moved back to x86 Python, so I cannot test this myself. 我自己已经回到了x86 Python,所以我自己无法测试。 Therefore, I encourage future visitors to try this answer, but I have not myself been able to test it. 因此,我鼓励未来的访客尝试这个答案,但我没有能够测试它。

  1. Might be a bug. 可能是一个bug。 Check out: https://bugs.python.org/ 退房: https//bugs.python.org/
  2. You can manually check the markers.py file and try to fix it. 您可以手动检查markers.py文件并尝试修复它。 I think there would a reference to sys_platform that has to be changed to sys.platform 我认为sys_platform的引用必须更改为sys.platform
  3. Regarding markerlib, you can try this out- 关于markerlib,你可以试试这个 -

     import markerlib marker = markerlib.compile("sys.platform == 'win32'") marker(environment=markerlib.default_environment(), override={'sys.platform':'win32'}) 

To fix this error, I found that installing the 0.7.3 version of distribute fixed this. 为了解决这个错误,我发现安装0.7.3版本的分发修复了这个问题。 I had also upgraded setuptools and pip along the way (so they may be needed as well), but after upgrading distribute this error finally went away. 我也一路上升级了setuptools和pip(所以也可能需要它们),但升级后分发这个错误终于消失了。

Try removing pip and distribute and setuptools, and then manually install pip using get-pip.py . 尝试删除pip并分发和setuptools,然后使用get-pip.py手动安装pip。

Then , download setuptools from here , extract -> go inside the extracted folder in command prompt and do python setup.py install 然后,从这里下载setuptools,解压 - >在命令提示符下进入解压缩文件夹并执行python setup.py install

Then , download distribute from here , extract -> go inside the extracted folder in command prompt and do python setup.py install 然后,从这里下载分发,解压缩 - >在命令提示符下进入解压缩文件夹并执行python setup.py install

I ran into this issue today myself, though on OSX. 我今天遇到了这个问题,尽管在OSX上。 I had run --upgrade as well as trying to uninstall and reinstall it completely. 我已经运行--upgrade以及尝试卸载并完全重新安装它。

Eventually, though I went into my site packages, and saw a "correct" version of setuptools (18.1) AS WELL as an older lingering version of it (completely separate version 15.1 of it). 最后,虽然我走进我的网站的包,看到一个“正确”的版本setuptools (18.1),以及它的一个较老版本的缠绵 (完全独立版吧15.1)。 Removing it all and reinstalling setuptools fresh fixed it for me. 删除所有并重新安装setuptools为我修复它。

Hopefully this helps someone else! 希望这有助于其他人!

I had an old verison of distribute, which didn't correctly resolve dependencies. 我有一个旧的分发版本,它没有正确解析依赖项。 It was fixed with 它是固定的

C:\Users\cshucks>pip install --upgrade distribute
Collecting distribute
  Downloading distribute-0.7.3.zip (145kB)
    100% |################################| 147kB 375kB/s
Collecting setuptools>=0.7 (from distribute)
  Downloading setuptools-19.2-py2.py3-none-any.whl (463kB)
    100% |################################| 466kB 440kB/s
Installing collected packages: setuptools, distribute
  Found existing installation: setuptools 16.0
    Uninstalling setuptools-16.0:
      Successfully uninstalled setuptools-16.0
  Found existing installation: distribute 0.6.49
    Uninstalling distribute-0.6.49:
      Successfully uninstalled distribute-0.6.49
  Running setup.py install for distribute
Successfully installed distribute-0.7.3 setuptools-19.2

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM