Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
272 views
in Technique[技术] by (71.8m points)

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

Running the following:

virtualenv -p python3 venv

gives:

Running virtualenv with interpreter /usr/bin/python3
Using base prefix '/usr'
New python executable in /specific/a/home/cc/students/csguests/taivanbatb/venv/bin/python3
Also creating executable in /specific/a/home/cc/students/csguests/taivanbatb/venv/bin/python
Installing setuptools, pip, wheel...

which is where it gets stuck.

Calling CTRL-C gives:

  File "/usr/local/bin/virtualenv", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 671, in main
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 2328, in <module>
    raise SystemExit(popen.wait())
  File "/usr/lib/python2.7/subprocess.py", line 1376, in wait
    pid, sts = _eintr_retry_call(os.waitpid, self.pid, 0)
  File "/usr/lib/python2.7/subprocess.py", line 476, in _eintr_retry_call
    return func(*args)
KeyboardInterrupt
    main()
  File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 713, in main
    symlink=options.symlink)
  File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 945, in create_environment
    download=download,
  File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 901, in install_wheel
    call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=SCRIPT)
  File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 769, in call_subprocess
    line = stdout.readline()
KeyboardInterrupt

Similar to this.

As suggested in the linked question, I tried installing with --no-wheel but to no avail. And I am sure it is not a network connectivity problem because setting up an environment using python2 using virtualenv env gives no errors.

The specific versions of all the packages I am using are as follows:

python 3.4.0 python 2.7.6 virtualenv 15.1.0

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...