python 3.2 import issue

后端 未结 3 988
野趣味
野趣味 2020-12-22 00:14

I\'ve been troubleshooting for the past few days trying to install distribute so I can start importing 3rd party modules. I haven\'t used python for a couple years so I\'m r

相关标签:
3条回答
  • 2020-12-22 00:42

    It is possible, that the file dist, is not to a recent version. Watch to this : https://pypi.python.org/pypi/distribute#uninstallation-instructions; and replace your folder normally in Python(version xxx)\scripts, by the highter version. It as raise this problem in my case, without all parse error on files describe before. Erase the previously version installed to finish.

    0 讨论(0)
  • 2020-12-22 00:44

    The issue is that Python 3 interprets octal numbers differently than Python 2.x. In 2.x you could just prefix a number with a 0 to indicate that it is octal. In Python 3 you prefix it with 0o, so your number needs to be 0o777.

    def _bypass_ensure_directory(name, mode=0o777):
    

    See http://docs.python.org/release/3.0.1/whatsnew/3.0.html#integers for more details.

    0 讨论(0)
  • 2020-12-22 01:00

    To install distribute (and pip, virtualenv):

    #!/bin/bash
    # download latest virtualenv.py
    wget https://raw.github.com/pypa/virtualenv/master/virtualenv.py
    
    # create a bootstrap virtual environment in ./venv directory
    python3 virtualenv.py venv
    

    To activate virtualenv:

    $ . ./venv/bin/activate
    

    Now you could use pip, easy_install to install other packages or use virtualenv-3.x to create new virtualenvs.

    If you use many virtualenvs (different projects, different python versions); you could pip installvirtualenvwrapper to manage them easily e.g., workon/mkvirtualenv/rmvirtualenv commands.

    0 讨论(0)
提交回复
热议问题