简体   繁体   中英

python returned non-zero exit status 1

I try to create a virtual environment to let me install NumPy, SciPy and Matplotlib I write this: python3.8 -m venv work3.8 and the result was: Error: Command '['/home/mohammed/work3.8/bin/python3.8', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1.

Please try: python3 -m venv [your directory]

After that, if you want to use your new virtual enviroment type: source [your directory]/bin/activate

Then if you want to leave your venv type: deactivate

(checked on Debian)

I hope that this helps you, Kind regards

Probably you got the message because the venv package is not present on your system for python3.8 or that you need sudo before the command.

Solve it by installing the venv package for python3.8 :

apt install python3.8-venv

Then create a new venv virtual environment:

python3.8 -m venv ~/.venvs/work3.8

The above assumes that inside your home directory, you have previously created a directory called .venv , inside of which the venv virtual environments will be stored. If not, it can be created with mkdir ~/.venv


You might need to prepend sudo to the commands, depending on what privileges your user has, like so:

sudo apt install python3.8-venv
sudo python3.8 -m venv ~/.venvs/work3.8

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM