无法在Mac上更改pyside的python版本

时间:2016-07-04 18:45:30

标签: python pycharm pyside anaconda osx-elcapitan

我正在尝试使用为我的计算机科学入门课程提供的库来设置PyCharm,但似乎因为我的python版本,我无法安装PySide,这对于库的导入是必要的。 python --version输出

Python 3.5.1 :: Anaconda 4.0.0 (x86_64)

当我尝试使用pip install pyside安装pyside时收到以下错误:

    Collecting PySide
  Using cached PySide-1.2.4.tar.gz
    Complete output from command python setup.py egg_info:
    only these python versions are supported: [(2, 6), (2, 7), (3, 2), (3, 3), (3, 4)]

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/vs/nq_fqyjn3hb_dhz35t4d18nh0000gn/T/pip-build-iyhkri8c/PySide/

我已经尝试通过安装pysel并运行sudo pysel 2.7.12将我的python版本更改为2.7,看起来它会受到支持,但这会给我以下错误:

    Traceback (most recent call last):
  File "//anaconda/bin/pysel", line 9, in <module>
    load_entry_point('pythonselect==1.3', 'console_scripts', 'pysel')()
  File "//anaconda/lib/python3.5/site-packages/pythonselect-1.3-py3.5.egg/pythonselect/pysel.py", line 287, in main
    p.set_curr_python(sys.argv[1])
  File "//anaconda/lib/python3.5/site-packages/pythonselect-1.3-py3.5.egg/pythonselect/pysel.py", line 212, in set_curr_python
    % (pyver_dir, pyver))
pythonselect.pysel.Error: '/Library/Frameworks/Python.framework/Versions/2.7.12' does not exist: you must install Python 2.7.12

但我确定我安装了python 2.7.12,与此错误消息相反。我尝试重新安装作为完整性检查并确认它已安装:

brew install python
Warning: python-2.7.12 already installed

我已经和它搏斗了好几天了,这让我很困惑。我的想法是Anaconda可能会引起问题,但我不确定。有什么想法吗?

编辑:我已根据您的建议尝试安装pyenv并遇到以下错误。再说一遍,看起来Anaconda正在引发一些冲突。

    ~ ➤ pip install pyenv
Collecting pyenv
  Downloading pyenv-20150113.1.tar.gz
Building wheels for collected packages: pyenv
  Running setup.py bdist_wheel for pyenv ... error
  Complete output from command //anaconda/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/vs/nq_fqyjn3hb_dhz35t4d18nh0000gn/T/pip-build-u_u2wk68/pyenv/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d /var/folders/vs/nq_fqyjn3hb_dhz35t4d18nh0000gn/T/tmpmwcdf4cipip-wheel- --python-tag cp35:
  running bdist_wheel
  running build
  installing to build/bdist.macosx-10.5-x86_64/wheel
  running install
  Cloning into '/Users/johnlewis/.pyenv'...
  Cloning into '/Users/johnlewis/.pyenv/plugins/pyenv-doctor'...
  Cloning into '/Users/johnlewis/.pyenv/plugins/pyenv-installer'...
  Cloning into '/Users/johnlewis/.pyenv/plugins/pyenv-pip-rehash'...
  Cloning into '/Users/johnlewis/.pyenv/plugins/pyenv-update'...
  Cloning into '/Users/johnlewis/.pyenv/plugins/pyenv-virtualenv'...
  Cloning into '/Users/johnlewis/.pyenv/plugins/pyenv-which-ext'...

  WARNING: seems you still have not added 'pyenv' to the load path.

  # Load pyenv automatically by adding
  # the following to your profile:

  export PATH="$HOME/.pyenv/bin:$PATH"
  eval "$(pyenv init -)"
  eval "$(pyenv virtualenv-init -)"
  b''
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/private/var/folders/vs/nq_fqyjn3hb_dhz35t4d18nh0000gn/T/pip-build-u_u2wk68/pyenv/setup.py", line 33, in <module>
      cmdclass=dict(install=PyenvInstall),
    File "//anaconda/lib/python3.5/distutils/core.py", line 148, in setup
      dist.run_commands()
    File "//anaconda/lib/python3.5/distutils/dist.py", line 955, in run_commands
      self.run_command(cmd)
    File "//anaconda/lib/python3.5/distutils/dist.py", line 974, in run_command
      cmd_obj.run()
    File "//anaconda/lib/python3.5/site-packages/wheel/bdist_wheel.py", line 232, in run
      self.distinfo_dir)
    File "//anaconda/lib/python3.5/site-packages/wheel/bdist_wheel.py", line 364, in egg2dist
      raise ValueError(err)
  ValueError: Egg metadata expected at build/bdist.macosx-10.5-x86_64/wheel/pyenv-20150113.1-py3.5.egg-info but not found

  ----------------------------------------
  Failed building wheel for pyenv
  Running setup.py clean for pyenv
Failed to build pyenv
Installing collected packages: pyenv
  Running setup.py install for pyenv ... error
    Complete output from command //anaconda/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/vs/nq_fqyjn3hb_dhz35t4d18nh0000gn/T/pip-build-u_u2wk68/pyenv/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/vs/nq_fqyjn3hb_dhz35t4d18nh0000gn/T/pip-m94qw5kz-record/install-record.txt --single-version-externally-managed --compile:
    usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
       or: -c --help [cmd1 cmd2 ...]
       or: -c --help-commands
       or: -c cmd --help

    error: option --single-version-externally-managed not recognized

    ----------------------------------------
Command "//anaconda/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/vs/nq_fqyjn3hb_dhz35t4d18nh0000gn/T/pip-build-u_u2wk68/pyenv/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/vs/nq_fqyjn3hb_dhz35t4d18nh0000gn/T/pip-m94qw5kz-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/vs/nq_fqyjn3hb_dhz35t4d18nh0000gn/T/pip-build-u_u2wk68/pyenv/
~ ➤

0 个答案:

没有答案