Tôi đang cố gắng tạo một môi trường ảo để phát triển ứng dụng Django. Bộ chỉ huy mà tôi đang sử dụng:
vagrant@vagrant:/var/www/djangogirls$ python3 -m venv myvenv
The virtual environment was not created successfully because ensurepip is not
available. On Debian/Ubuntu systems, you need to install the python3-venv
package using the following command.
apt-get install python3-venv
You may need to use sudo with that command. After installing the python3-venv
package, recreate your virtual environment.
Failing command: ['/var/www/djangogirls/myvenv/bin/python3', '-Im', 'ensurepip', '--upgrade', '--default-pip']
vagrant@vagrant:/var/www/djangogirls$ sudo apt-get install python3-venv
Reading package lists... Done
Building dependency tree
Reading state information... Done
python3-venv is already the newest version (3.5.1-3).
The following packages were automatically installed and are no longer required:
javascript-common libjs-jquery libjs-sphinxdoc libjs-underscore python-pbr python-pkg-resources
python-six python-stevedore python3-virtualenv virtualenv virtualenv-clone
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 108 not upgraded.
vagrant@vagrant:/var/www/djangogirls$ python3 -m ensurepip
ensurepip is disabled in Debian/Ubuntu for the system python.
Python modules for the system python are usually handled by dpkg and apt-get.
apt-get install python-<module name>
Install the python-pip package to use pip itself. Using pip together
with the system python might have unexpected results for any system installed
module, so use it on your own risk, or make sure to only use it in virtual
environments.
vagrant@vagrant:/var/www/djangogirls$ rm -r myvenv/
vagrant@vagrant:/var/www/djangogirls$ python3 -m venv myvenv
The virtual environment was not created successfully because ensurepip is not
available. On Debian/Ubuntu systems, you need to install the python3-venv
package using the following command.
apt-get install python3-venv
You may need to use sudo with that command. After installing the python3-venv
package, recreate your virtual environment.
Failing command: ['/var/www/djangogirls/myvenv/bin/python3', '-Im', 'ensurepip', '--upgrade', '--default-pip']
Như bạn có thể thấy, tôi đang cố gắng tạo ra một myvenv, không thể tạo ra do python3-venv bị mất. Tôi đã cài đặt cái này, nhưng đảm bảo thiếu pip. Sau khi tìm kiếm, có vẻ như hệ thống (Ubuntu 16.04) không khuyến khích việc sử dụng gói. Ai đó có thể giúp tôi giải quyết vấn đề này không?
/var/www/djangogirls/myvenv/bin/python3 -Im ensurepip ...
, có thể thất bại vì những lý do hoàn toàn khác nhau.