setting up environment in virtaulenv using python3 stuck on setuptools, pip, wheel

后端 未结 4 1961
执念已碎
执念已碎 2020-12-04 01:19

Running the following:

virtualenv -p python3 venv

gives:

Running virtualenv with interpreter /usr/bin/python3
Using base prefi         


        
相关标签:
4条回答
  • 2020-12-04 01:59

    1.Check your internet connections.

    2.Set python3 as your default python interpreter since you have python2.7 as your default python interpreter. Try using without any wheel by:

    virtualenv venv --no-wheel
    

    Then activate virtualenv and run:-

    pip install --upgrade pip
    pip install setuptools --no-use-wheel --upgrade
    pip install wheel --no-cache 
    

    If you are behind proxy then use:-
    sudo pip download setuptools pip wheel --proxy http://<yourproxyhere>

    After all this virtualenv -p python3 venv is working in my virtualenv perfectly.
    NOTE: Assuming virtual environment is already set in your system and python3 is your default interpreter.

    Alternatively, you don't need to do virtualenv -p python3 venv. You can specify python interpreter(present in /usr/bin/* folder) which you want to use in virtualenv and use it like this:-
    virtualenv --python=/usr/bin/pythonX.Y /home/username/path/to/virtualenv_name

    if you want to install in the current working directory then you can use:-
    virtualenv --python=/usr/bin/pythonX.Y virtualenv_name
    REFERENCE

    0 讨论(0)
  • 2020-12-04 02:04

    virtualenv is a just a python package. And you can install it both on python2 and python3.

    In my experience, virtualenv on python3 handles both python versions well. Your stacktrace shows that you use virtualenv for python2 - try switching to python3.

    To install it on python3, run

    pip3 install virtualenv
    

    or, if you have to use apt-get for some reason,

    apt-get install python3-virtualenv
    
    0 讨论(0)
  • 2020-12-04 02:13

    Your stack trace indicates you are using virtualenv from your 2.7 installation. This would indicate that your PATH is not set for 3.x. Start a new shell, set the PATH so that /usr/local/lib/python2.7 is not on it, and try again.

    0 讨论(0)
  • 2020-12-04 02:13

    try this when net connect is not available:

    virtualenv --no-setuptools --no-wheel env_only_pip 
    

    you can still use pip when enter virtualenv

    pip install --no-index --find-links=file:py_package -r requirements.txt
    
    0 讨论(0)
提交回复
热议问题