Python-share package安装问题解决方案

报错:


C:\Users\jingsheng.liu>pip install Share
Collecting Share
  Using cached share-1.0.4.tar.gz (5.9 kB)
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: Share
  Building wheel for Share (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [60 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build\lib
      creating build\lib\share
      copying share\config.py -> build\lib\share
      copying share\data.py -> build\lib\share
      copying share\server.py -> build\lib\share
      copying share\sock.py -> build\lib\share
      copying share\tran_server.py -> build\lib\share
      copying share\__init__.py -> build\lib\share
      running build_scripts
      creating build\scripts-3.8
      copying and adjusting bin\share -> build\scripts-3.8
      installing to build\bdist.win-amd64\wheel
      running install
      running install_lib
      creating build\bdist.win-amd64
      creating build\bdist.win-amd64\wheel
      creating build\bdist.win-amd64\wheel\share
      copying build\lib\share\config.py -> build\bdist.win-amd64\wheel\.\share
      copying build\lib\share\data.py -> build\bdist.win-amd64\wheel\.\share
      copying build\lib\share\server.py -> build\bdist.win-amd64\wheel\.\share
      copying build\lib\share\sock.py -> build\bdist.win-amd64\wheel\.\share
      copying build\lib\share\tran_server.py -> build\bdist.win-amd64\wheel\.\share
      copying build\lib\share\__init__.py -> build\bdist.win-amd64\wheel\.\share
      running install_data
      creating build\bdist.win-amd64\wheel\share-1.0.4.data
      creating build\bdist.win-amd64\wheel\share-1.0.4.data\data
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "C:\Users\jingsheng.liu\AppData\Local\Temp\pip-install-dizvi0q1\share_3bec5e901da746d894346812606cc50e\setup.py", line 11, in <module>
          setup(
        File "c:\users\jingsheng.liu\appdata\local\programs\python\python38\lib\distutils\core.py", line 148, in setup
          dist.run_commands()
        File "c:\users\jingsheng.liu\appdata\local\programs\python\python38\lib\distutils\dist.py", line 966, in run_commands
          self.run_command(cmd)
        File "c:\users\jingsheng.liu\appdata\local\programs\python\python38\lib\distutils\dist.py", line 985, in run_command
          cmd_obj.run()
        File "c:\users\jingsheng.liu\appdata\local\programs\python\python38\lib\site-packages\wheel\bdist_wheel.py", line 335, in run
          self.run_command('install')
        File "c:\users\jingsheng.liu\appdata\local\programs\python\python38\lib\distutils\cmd.py", line 313, in run_command
          self.distribution.run_command(command)
        File "c:\users\jingsheng.liu\appdata\local\programs\python\python38\lib\distutils\dist.py", line 985, in run_command
          cmd_obj.run()
        File "c:\users\jingsheng.liu\appdata\local\programs\python\python38\lib\site-packages\setuptools\command\install.py", line 61, in run
          return orig.install.run(self)
        File "c:\users\jingsheng.liu\appdata\local\programs\python\python38\lib\distutils\command\install.py", line 557, in run
          self.run_command(cmd_name)
        File "c:\users\jingsheng.liu\appdata\local\programs\python\python38\lib\distutils\cmd.py", line 313, in run_command
          self.distribution.run_command(command)
        File "c:\users\jingsheng.liu\appdata\local\programs\python\python38\lib\distutils\dist.py", line 985, in run_command
          cmd_obj.run()
        File "c:\users\jingsheng.liu\appdata\local\programs\python\python38\lib\distutils\command\install_data.py", line 56, in run
          dir = convert_path(f[0])
        File "c:\users\jingsheng.liu\appdata\local\programs\python\python38\lib\distutils\util.py", line 122, in convert_path
          raise ValueError("path '%s' cannot be absolute" % pathname)
      ValueError: path '/etc' cannot be absolute
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for Share
  Running setup.py clean for Share
Failed to build Share
Installing collected packages: Share
  Running setup.py install for Share ... error
  error: subprocess-exited-with-error

  × Running setup.py install for Share did not run successfully.
  │ exit code: 1
  ╰─> [47 lines of output]
      running install
      running build
      running build_py
      creating build
      creating build\lib
      creating build\lib\share
      copying share\config.py -> build\lib\share
      copying share\data.py -> build\lib\share
      copying share\server.py -> build\lib\share
      copying share\sock.py -> build\lib\share
      copying share\tran_server.py -> build\lib\share
      copying share\__init__.py -> build\lib\share
      running build_scripts
      creating build\scripts-3.8
      copying and adjusting bin\share -> build\scripts-3.8
      running install_lib
      byte-compiling c:\users\jingsheng.liu\appdata\local\programs\python\python38\Lib\site-packages\share\server.py to server.cpython-38.pyc
        File "c:\users\jingsheng.liu\appdata\local\programs\python\python38\Lib\site-packages\share\server.py", line 187
          except Fault, f:
                      ^
      SyntaxError: invalid syntax

      running install_data
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "C:\Users\jingsheng.liu\AppData\Local\Temp\pip-install-dizvi0q1\share_3bec5e901da746d894346812606cc50e\setup.py", line 11, in <module>
          setup(
        File "c:\users\jingsheng.liu\appdata\local\programs\python\python38\lib\distutils\core.py", line 148, in setup
          dist.run_commands()
        File "c:\users\jingsheng.liu\appdata\local\programs\python\python38\lib\distutils\dist.py", line 966, in run_commands
          self.run_command(cmd)
        File "c:\users\jingsheng.liu\appdata\local\programs\python\python38\lib\distutils\dist.py", line 985, in run_command
          cmd_obj.run()
        File "c:\users\jingsheng.liu\appdata\local\programs\python\python38\lib\site-packages\setuptools\command\install.py", line 61, in run
          return orig.install.run(self)
        File "c:\users\jingsheng.liu\appdata\local\programs\python\python38\lib\distutils\command\install.py", line 557, in run
          self.run_command(cmd_name)
        File "c:\users\jingsheng.liu\appdata\local\programs\python\python38\lib\distutils\cmd.py", line 313, in run_command
          self.distribution.run_command(command)
        File "c:\users\jingsheng.liu\appdata\local\programs\python\python38\lib\distutils\dist.py", line 985, in run_command
          cmd_obj.run()
        File "c:\users\jingsheng.liu\appdata\local\programs\python\python38\lib\distutils\command\install_data.py", line 56, in run
          dir = convert_path(f[0])
        File "c:\users\jingsheng.liu\appdata\local\programs\python\python38\lib\distutils\util.py", line 122, in convert_path
          raise ValueError("path '%s' cannot be absolute" % pathname)
      ValueError: path '/etc' cannot be absolute
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> Share

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

分析:

无法处理/etc

File "c:\users\jingsheng.liu\appdata\local\programs\python\python38\lib\distutils\util.py", line 122, in convert_path
          raise ValueError("path '%s' cannot be absolute" % pathname)
      ValueError: path '/etc' cannot be absolute

解决:

打开util.py

    if os.sep == '/':
        return pathname
    if not pathname:
        return pathname

'''根据报错增加的代码段'''
    if pathname.startswith('/etc'):
        paths = pathname.split('/')
        return '\\etc\\' + paths[-1]
'''根据报错增加的代码段'''

    if pathname[0] == '/':
        raise ValueError("path '%s' cannot be absolute" % pathname)
    if pathname[-1] == '/':
        raise ValueError("path '%s' cannot end with '/'" % pathname)

修改后重新安装:安装成功

 C:\Users\jingsheng.liu>pip install --index-url https://pypi.tuna.tsinghua.edu.cn/simple/ share==1.0.4
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple/
Collecting share==1.0.4
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/f5/fb/07e73d2551046cb23a37cd423c490bdcc5151f6cf79b8fdf5e3f6df318dd/share-1.0.4.tar.gz (5.9 kB)
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: share
  Building wheel for share (setup.py) ... done
  Created wheel for share: filename=share-1.0.4-py3-none-any.whl size=8989 sha256=fac7bc4626cce9859bfee784ffb6b960167b1cef0a15c54147a3382c02fa1728
  Stored in directory: c:\users\jingsheng.liu\appdata\local\pip\cache\wheels\e8\18\2f\394482d27600a54bda5e1848ec9eecbd553052c75663d8191b
Successfully built share
Installing collected packages: share
Successfully installed share-1.0.4

  • 3
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值