简体   繁体   中英

Python - pip3.7 can't install virtualenv

Good morning guys

I ended up creating several Python builds (2.7.18, 3.6.10, 3.7.7, 3.8.2, 3.9.0) downloading the tar.gz for each of these versions and creating the build.

I know that it is recommended to use only the pip of one of them and then create a virtual environment, however, I want to have the flexibility to use the pip of any of these versions to install the dependencies because that way I can create an alias for both pip and python and change the versions whenever I want.

When I went to install virtualenv with python 3.7.7 pip3.7, I am getting the following error:

虚拟环境

I was able to install requests and NumPy, so I would like to know if virtualenv can in fact be installed in versions above 3.6, below you can see the correct installations.

麻木的

要求

Anyone who can help would be grateful.

According to the following question, you should install libffi-devel :

Python3: ImportError: No module named '_ctypes' when using Value from module multiprocessing

1 - Install Essential Dependencies

Installing the dependencies below, mainly libffi-dev for systems like Ubuntu/Mint/ Debian and libffi-devel for systems like Fedora/ CentOS:

Ubuntu/Mint/Debian

sudo apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev \
libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \
xz-utils tk-dev libffi-dev liblzma-dev python-openssl git

Fedora/CentOS

sudo yum install @development zlib-devel bzip2 bzip2-devel readline-devel sqlite \
sqlite-devel openssl-devel xz xz-devel libffi-devel findutils

2 - Installing Python

After installing the above dependencies, if you are creating manually, you must perform the procedures below:

  • Remove the version you generated earlier
  • Run./configure
  • Run make
  • Run sudo make altinstall

This way you will be able to install all dependencies without any errors.

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